Posted By
|
Message
|
Rob Rule Rusten Crating
Registered 22/12/2007
Points 532
|
26th May, 2008 at 05:03:30 -
Hi, relative newbie here. I've got individual raindrops in a top down 2d rpg I'm making, and I want to destroy these at random so they appear as if they're hitting the ground. (I've partially chosen this way because I have a second kind of raindrop which destroys upon collision with rooftops and other objects ingame.)
Right now I've got MMF picking one raindrop at random every (let's say) 1 second. ie
Every 1 second
Pick one of raindrop (destroy raindrop)
Is there a more efficient way to destroying them? It seems a bit of a poor method.
I would also like to alter the destroy dependant on whether they get destroyed over ground or over water (ground creates a splash, water a ripple, you get the picture). I'm not sure how to do this at all; how to attribute an animation to destroy or how to change it dependant on its position, and if I managed it would almost certainly do it in a hugely inefficient manner.
Help much appreciated.
It'll all blow over.
|
Pixelthief Dedicated klik scientist
Registered 02/01/2002
Points 3419
|
26th May, 2008 at 05:17:55 -
When you generate each raindrop, give it an alterable value set to a random number, such as A = 50 + random(50)
Then have an event that subs the raindrops value A by 1 each frame (always: sub 1 A)
Then just have it so when their A = 0, it is destroyed (Value A(Drop) = 0 --> destroy drop)
If you want to modify this for those positions like roof/water, you can just change the "when A = 0" code.
Instead of:
*Value A("Drop") = 0
=Destroy Drop
Put in:
*Value A("Drop") = 0
+Pick all objects in a zone (find this under the egg shaped "objects" conditions, then set the zone for your water)
=Set Value A of Drop to 100000 (this is important, or else it will trigger the next couple events)
=Set Animation Direction of Drop to 1
=Destroy Drop
*Value A("Drop") = 0
+Pick all objects in a zone (find this under the egg shaped "objects" conditions, then set the zone for your roof)
=Set Value A of Drop to 100000 (this is important, or else it will trigger the next couple events)
=Set Animation Direction of Drop to 2
=Destroy Drop
*Value A("Drop") = 0
=Set Value A of Drop to 100000
=Set Animation Direction of Drop to 0
=Destroy Drop
Then, put the animations for your raindrop being destroyed over land, water, and roofs into the animation "Disappearing" of the raindrop in the directions 0, 1, & 2 respectively. What this is doing, is first checking if the drop is over a land or water when it is destroyed, and setting the direction of the animation so it shows that animation when it is destroyed. If it ISNT overlapping those zones, it will default to the "over ground" animation.
Gridquest V2.00 is out!!
http://www.create-games.com/download.asp?id=7456
|
|
|