addEventListener(Event.ENTER_FRAME,downspike) function downspike(e:Event):void{ function downspike( timerEvent:TimerEvent ):void{ gameTimer = new Timer(25) gameTimer.addEventListener(TimerEvent.TIMER, downspike) gameTimer.start() }
so i know my code is super sloppy. i started of thinking i was going code it all on my own then i ended up needing help and stupidly tried to add stuff from a tutorial. i probaly should just erase the stuff from the tutorial and attempt it myself. but im at a lose anyway... so with my code i have a spike coming down and a ball that follows my mouse and i was hoping that when the two hit it would be a crude game over type thing but it would really just freeze. but rather it gave me that error. so anybody who feels up to helping me can choose one of two options. either help me try and fix this coding. or suggest a better way to make it well the spike hits the ball its a sense of game over
lol beastmode i didn't even realise that till now. it was fixed a long time ago when i just erased it and tried something else
but anywho im here cause im about to die of insanity! (i think im the first person to ever think of insanity as a way of death... kudos me) anywho i have the capability to code the entirety of this game im making except for one part... collision decetion. i tried wes's tut site and tried like a million tut's but i couldn't figure them out! really all i need is for the game to stop when they hit. if i could just get it so that it appears to freeze and do nothing else when they collide i could work from there but i can't fiqure it out! i know to use the hittestobject i have to make it so that something happens when they collide but i don't know any codeing that can help me! if anyone could help that would be a miracle
Oh to a hit test that says like: onClipEvent (enterFrame) { this._y += speed;//moves the enemy downwards if (this.hitTest(_root.player)) {//if the enemy hits the player _root.gotoAndStop(2);//goto the second frame, which will be a gameover screen }
Then make a frame 2 or next frame that is the game over screen.
ok one last question youve been a giant help but i have used this code before.
so i copied and pasted the code and i got a bunch of errors for enterFrame and the onClipEvent and _root .
all saying it is undefined
so i was wondering. do i need to put in a function or var or class or something?
P.S i was using diffrent code for the enemy to move down and i see you included code for that. should i use your code or the code i was using which is a simple: