I'm currenlty developing a game and working on the code at the moment for all the different parts beforew I do most of the graphics. Heres what I have so far:
http://logicaloption.com/mckenna/g.htm
I have Level 1 and 2 working okay but when I get to level 3 (30 points) the new Nets no longer appear on the screen I don't want to post the .fla file here but I will expalin the main bits of code below:
Each Level in the game goes to the next frame and each next frame has another net on it. It progresses to each level with the following code:
Code:
onClipEvent (enterFrame) {
if (_root.score >= 20) {
_root.gotoAndStop("level02");
}
}
onClipEvent (enterFrame) {
if (_root.score >= 30) {
_root.gotoAndStop("level03");
}
}
onClipEvent (enterFrame) {
if (_root.score >= 40) {
_root.gotoAndStop("level04");
}
}
etc.
then each Net has this code applied:
Code:
onClipEvent (load) {
dx = Math.random()*5-2;
// set the initial momentum of the net
dy = Math.random()*5-2;
}
onClipEvent (enterFrame) {
_x += dx;
// Move the ball along dx and dy
_y += dy;
if (_x<25) {
_x = 25;
// move it back on screen
dx *= -1;
// reverse the horizontal momentum
} else if (_x>494) {
_x = 494;
// move it back on screen
dx *= -1;
// reverse the horizontal momentum
}
if (_y<25) {
_y = 25;
// move it back on screen
dy *= -1;
// reverse the vertical momentum
} else if (_y>205) {
_y = 205;
// move it back on screen
dy *= -1;
// reverse the vertical momentum
}
}
onClipEvent (load) {
function reset1() {
this._x = -90;
this._y = 0;
}
}
onClipEvent (load) {
if (this.hitTest(_root.character)) {
reset1();
}
}
Although when I get to level 3 the nets dont seem to appear and then once I go into the top left corner it triggers the goto game over frame. Any ideas what could be causing this to not work?