Skip to main content
GameDev.net gamedev.net
🔒 Locked

Anyone know Actionscript? help please?

Started by Wavewash May 2, 2004 at 1:04 PM 0 replies 250+ views
Original Post
Wavewash
Wavewash
Hi, No one on flashmove.com seemed helpful so I thought someone on gamedev may be able to help me. I wasn't sure where to put this so mods feel free to move it if I've placed it in the wrong spot. I'm having some trouble with my script and I was hoping that someone could see what I am doing wrong. I have two objects on the stage. One is a paddle and the other is a ball. Both are movie objects. The ball movie duplicates itself at time intervals and basically fall towards the paddle. If they fall below the paddle I would like to remove that ball from the stack. The problem is that other balls are being removed from the stack other then the one that is below the paddle object. The function checks to see if a ball is dead in the addball function so I don't have to check everysingle frame. Anyways if anyone can see why random balls are being deleted and can help me I would greatly appreciate it. All the code below is put in the first frame and then the second frame just has the script "stop();". Thanks in advance. ballstack=new Array(); ballid=0; StageWidth = 600; StageHeight = 400; var ballreleaseid; ballreleaseid=setInterval(addball,1); ballnumber=1; function addball(){ ballid=ballstack.length; ballstack.push(ball_mc.duplicateMovieClip("ballCopy"+ballid,ballid)); ballstack[ballid].alive=true; ballstack[ballid].yspeed=0; ballstack[ballid].xspeed=2; ballstack[ballid].onEnterFrame = ballbounce; trace(ballid); var c=0; while(c0)) { this.yspeed=-this.yspeed; } this._y+=this.yspeed; this._x-=this.xspeed; //trace(this._x); if(this._y>paddle_mc._y+paddle_mc.height){ this.alive=false; } } paddle_mc.onEnterFrame = moveStuff; [edited by - Wavewash on May 2, 2004 2:11:55 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.