View Full Version : worm game
tstefan
October 24th, 2002, 06:58 PM
Does somebody have a code for worm or snake game.
Please sent it to : t0mc4thr@yahoo.com
:-\
upuaut
October 25th, 2002, 12:40 AM
do you mean a game like the Tron laser bike game? I think the origional was called blockade?
pom
October 25th, 2002, 02:37 AM
Is it really that complicated? (http://kirupaforum.com/showthread.php?s=&threadid=7457)
upuaut
October 25th, 2002, 02:42 AM
It could be. Lets see you'd need at least the following
attach movie clip, hit detection, and keyboard interaction methods.
I guess for a first year Flasher that might be tough.
pom
October 25th, 2002, 02:54 AM
No Upu, I meant: is it really that complicated to read the thread called "Please read before posting" and write which version of Flash you're running.
Of course, the game in itself is complicated...
pom :P
upuaut
October 25th, 2002, 03:31 AM
lol.. sorry. didn't know what you meant.
Scootman
October 25th, 2002, 02:23 PM
well im not too hot on using arrays and stuff in flash... i use them all the time n c++... but i suppose you could have 1 movie clip... and record its x and y position in an array on enter frame... and then apply that to the next movie clip in the "snake" so it will follow the path... im not exactly sure about tackling this... but ive seen it used before in mouse followers... and i know depending on the size of the array it adjusts the delay of it following.. im sure one of the smart people here can do this in there sleep... lol i wish i could...
oh yeah and about continuous movement in a direction which im assuming you will need... i did it once... on accident... i was messin with the if(Key.isDown) thing... and it just kept goin in one direction... forget how to do it exactly though... but i think this is what you mean anyway by the worm game...
tstefan
October 30th, 2002, 03:35 PM
I would like to thank sootman for the array hint.
This is what has come out, it is not finished yet but test it anyway.
http://www.inet.hr/~tstefan/worm/
Worm Game now for two players too.
:) :) :) :) :) :) :) :)
Scootman
October 30th, 2002, 06:47 PM
glad i could help...:)
pom
October 30th, 2002, 10:15 PM
Wow! Nice job, man!
tstefan
October 31st, 2002, 02:42 AM
This is the code that calculates the moovement of the worm:
i = 1;
oldx[0] = _root.master._x;
oldy[0] = _root.master._y;
master._x += speedx;
master._y += speedy;
while (i<=myLength) {
oldx[0]= myTrails[i]._x;
myTrails[i]._x += (oldx[i-1]-oldx[i])/1.5;
oldy[0]= myTrails[i]._y;
myTrails[i]._y += (oldy[i-1]-oldy[i])/1.5;
i = i+1;
}
Master is the movie clip which is followed.
-myTrails is array with duplicated master clips.
-oldx and oldy are arrays in witch old movie clip positions are recorded and than assigned to a new clip.
If you putt _xmouse and _ymouse instead speedx and speedx you will get nice mouse follower.
Try it.
tstefan
November 1st, 2002, 09:24 AM
http://www.inet.hr/~tstefan/worm/
Worm Game now for two players too.
Let's eat those apples.
:) :) :) :) :) :) :) :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.