View Full Version : game enemy movement
whitegriffin
01-22-2002, 06:41 AM
i have this game that i mad but i want the "bad gus" in the game, when crossing acrcoss the screen have an up and down motion i tried editing the movie clip but i need some action script to say wehn enter ___x cord play frame label _____ ill attach the fla file cause i got some weid scripting soo here it is:
game (http://www.geocities.com/thewhitegriffin/game1.7.fla)
red penguin
01-22-2002, 08:18 AM
....fla....too...large....to....DL......
you say you want random y movement from a clip moving from left to right? Is this what I understand?
Jesse
01-23-2002, 01:02 AM
As far as I hear it you've got the movement going but you want to be able to check if the object is yet at a set _x. Is that right? That's a simple getProperty loop...
whitegriffin
01-23-2002, 01:06 AM
ok so i got these enemys that scroll across the screen but they olny can move in a straight line along the x cord i want it so they still move along the x cord but i want them to have an up and down mothion when the enter the screen (making it a little harder
Jesse
01-23-2002, 01:22 AM
OK here's some code I threw together to make an MC move up or down:
onClipEvent (load) {
this.upper = 180;
this.lower = 280;
this._y = (upper+lower)/2;
this.yDir = random(10)>5 ? 1 : -1;
}
onClipEvent (enterFrame) {
if (upper>this._y) {
this.yDir = 1;
} else if (lower<this._y) {
this.yDir = -1;
}
this._y += 4*this.yDir;
}
The upper and lower variables define the top and bottom _y. You can make them random...
whitegriffin
01-23-2002, 01:27 AM
thanks a lot that worked perfect!
red penguin
01-23-2002, 01:32 AM
Beat to the punch by the master himself....
mr. smarty pants...putting something like that in this forum without explanation...isn't that a violation of the rules?
heheh
it's a hoke, a hoke I say!
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.