Okay so I'm making this flash game for school. The object of the game is simple, there are gonna be apples dropping from the screen and then you have a character that moves left and right trying to catch the falling apples. My problem is that I want multiple apples falling from the top of the screen and for them to disappear when the character hits the apples.
here is the code in my apple:
onClipEvent (load) {
this._x = 200*Math.random();
this._y= 0;
}
onClipEvent (enterFrame) {
this._y += 10;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.goku)) {
_root.i+=1;
duplicateMovieClip(_root.apple,"apple"+i,10)
this.removeMovieClip();
//trace("hello");
}
}
When I start the game, well, it doesn't do what I want it to do. An apple would fall from the sky, as soon as I hit it, a second apple falls from the sky and spazzes out for as long as the first apple is hitting the character. Also, the first apple doesn't disappear but the second one would
Help?
Note: yes, the instance names are done correctly.
here is the code in my apple:
onClipEvent (load) {
this._x = 200*Math.random();
this._y= 0;
}
onClipEvent (enterFrame) {
this._y += 10;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.goku)) {
_root.i+=1;
duplicateMovieClip(_root.apple,"apple"+i,10)
this.removeMovieClip();
//trace("hello");
}
}
When I start the game, well, it doesn't do what I want it to do. An apple would fall from the sky, as soon as I hit it, a second apple falls from the sky and spazzes out for as long as the first apple is hitting the character. Also, the first apple doesn't disappear but the second one would
Help?
Note: yes, the instance names are done correctly.