View Full Version : Create a random walk in two dimensions
johnny2002gr
12-30-2001, 11:07 PM
Hi to everyone. I want to create a random walk of a ball in 2d grid. I have the required algorith but i don't know how to apply it in Flash. Anyone to help please ?
The required informations & the algorith are in the attachment. Please download.
Jesse
01-01-2002, 10:19 AM
Attached is a FLA I whipped up which meets most of your specs. It's Intermediate level scripting. Good luck.
Since I don't have Word I can't see the image you included.
johnny2002gr
01-02-2002, 10:53 PM
Thanks a lot my friend. Happy new year to you and other friends of the forum. I need some more help:
1) How i can add more walkers walking at the same time?
2) How can i draw the curve writing each walker?
I attach a fla with the graphic that you coulden't see and some your's original fla with some add ons. I'm waiting your answers.
Thanks again.
johnny2002gr
01-02-2002, 10:54 PM
Thanks a lot my friend. Happy new year to you and other friends of the forum. I need some more help:
1) How can i add more walkers walking at the same time?
2) How can i draw the curve writing each walker?
I attach a fla with the graphic that you coulden't see and some your's original fla with some add ons. I'm waiting your answers.
Thanks again.
Jesse
01-04-2002, 01:24 AM
1) Simply create another walker graphic and give it the instance name 'walker2', then change the walkers variable (on Frame 1) to 2.
2) I'm not sure what you mean. If you want to lay out tracks after the walker moves, that can be done using duplicateMovieClip. If you want to controll the movement via a track, we've gone about it the wrong way (and that's harder).
johnny2002gr
01-04-2002, 12:39 PM
Ok. I just make 10 walkers walking the same time. For the second part i made i sample animation with tradition way (without actioscript) to see exactly want i want to do. Please take a look to the attached fla. Thanks again.
Jesse
01-05-2002, 11:04 AM
See the attached file. It's a bit ugly and the code is the same for the most part for each direction, so it could be simplified, but I've not the time tonight. It seems to be mapping the movement correctly though.
johnny2002gr
01-07-2002, 11:21 PM
I tried the code you give me last time and we have the final result. I think is pretty. Take a look. Thanks for your help...See you.
Jesse
01-08-2002, 12:41 AM
Excellent. I'll add that to the movies DB if you don't have any objection. One final tweak would be to detect if a path is already laid in the current position, so as to reduce the numberof path pieces put down and save memory, but I think determining if one existed would in fact use more memory, so I wouldn't bother. Job well done!
johnny2002gr
01-08-2002, 06:29 PM
I have no problem to put the movie in downloads. I hope to find time creating something else next days...:)
johnny2002gr
01-11-2002, 12:47 AM
I want some add on to control the movie. I don't know if this is easy. I tried a lot, but finally i didn't do anythink. I want to have two buttons on the stage. I want use the first to start walker movement and the second to stop the movement. If this easy give me a solution please.
Jesse
01-25-2002, 01:51 AM
From memory the clips are moved using a clipEvent enterFrame. Just put a conditional around it:
if (_root.move == true)
Set _root.move to true to begin with but to false when the stop button is clicked.
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.