Posted By
|
Message
|
Brice Morrison
Registered 03/10/2008
Points 303
|
15th January, 2009 at 08:38:34 -
Hello everyone!
I'm trying to make a collection of fireflies that will scatter when you mouse over them, and then slowly move back to their original spot. I can get it so that they all store their original X,Y values in their Value A and Value B, and I can spread their ID through Value C, but I can't seem to get things working.
What currently happens is that they all move when you mouse over them, but only one of them returns to its original spot, and it takes all the others with it (all of them are affected by the move).
The current code I have is:
+Always
- Run loop "firefly" [number of (Fly)] times
+Mouse overlaps (Fly)
- Set (Fly) to random new position
+On loop "firefly"
+Value C of (Fly) = LoopIndex "firefly"
+X(Fly) < Value A(Fly)
- Set X pos (Fly) to X(Fly) plus 1
...and then I have three more copies of this for the rest of the X and Y coordinates.
Anyone have any ideas? Thanks!
http://www.TheGameProdigy.com
|
MBK
Registered 07/06/2007
Points 1578
|
15th January, 2009 at 19:36:06 -
Maybe it should be ... X(Fly) < X(Fly) plus Value A(Fly) ?
<shrugs> did that work or no ? Probably not ...
If not then do the following:
Try always setting a value (can make another active if need be) to the exact screen position of the Fly .. then set another value to the current position of the Fly just before the Fly's move when moused over code initiates.
And then .. If the "always to Fly position" Value does not match up with the "set just before moused over" Value, the Fly decreases or increases its X-pos based upon whether it is less than the "set just before moused over" value or greater than it.
That should work I would think. If not, then I'd need to look at the source and play with it some to see exactly what's what.
I could be wrong about this (because I don't really know what that line with the "LoopIndex" does (i tend to avoid the loops and use groupings and activations instead),
But ...
To me, your code "X(Fly) < Value A(Fly)" doesn't make sense in the context that it's used here.
Because you are basically telling it to do actions based solely on the Value A of Fly and that Value is usually something like 1, 2, 3, 4, 5, etc. ... so you are setting the X position according to whether it is less than 1, 2, 3, 4, 5, etc.
Know what I mean ?
Hope that helps some.
Click Me! http://www.create-games.com/project.asp?view=main&id=1444
http://www.mediafire.com/download.php?aoo1dnnlq5i
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?
|
|
|