I want to move these boxes around the screen independantly. For level 4 I get stuck in what I dont no. The boxes also seem to move as a unit too.
I feel like there is a more simple way to do what I want here too. Go easy one me this is my first attmpt at simple gaming code.
Link to the swf - Get to level 4 and you will see the issue.
http://www.wisc-online.com/prototypes/Jgame/shooter.swf
Full source files
http://www.wisc-online.com/prototypes/Jgame/shooter.zip
Heres an image of what I want to happen.
Code:var Dir:String = "down" var Speed:Number = new Number() addEventListener(Event.ENTER_FRAME,myFunction); function myFunction(event:Event) { if(CurLevel == 1){ //Do not move boxes }else if(CurLevel == 2 && CanPlay =="yes"){ Movelevel2("mc0"); Movelevel2("mc1"); Movelevel2("mc2"); Movelevel2("mc3"); }else if(CurLevel == 3 && CanPlay =="yes"){ Movelevel3("mc0"); Movelevel3("mc1"); Movelevel3("mc2"); Movelevel3("mc3"); }else if(CurLevel == 4 && CanPlay =="yes"){ Movelevel4("mc0"); Movelevel4("mc1"); Movelevel4("mc2"); Movelevel4("mc3"); } } function Movelevel4(mc:String) { for (i=0; i<4; i++) { if(this[mc].x>720){ Dir = "downleft" }else if(this[mc].x<-50){ Dir = " upright" }else if(this[mc].y>500){ Dir = "upleft" }else if(this[mc].y<150){ Dir = " downright" } } if(Dir == "downright"){ for (i=0; i<4; i++) { this[mc].x+=Math.ceil(Math.random()*3); this[mc].y+=Math.ceil(Math.random()*3); } }else if(Dir == "upright"){ for (i=0; i<4; i++) { this[mc].x+=Math.ceil(Math.random()*3); this[mc].y-=Math.ceil(Math.random()*3); } }else if(Dir == "downleft"){ for (i=0; i<4; i++) { this[mc].x-=Math.ceil(Math.random()*3); this[mc].y+=Math.ceil(Math.random()*3); } }else if(Dir == "upleft"){ for (i=0; i<4; i++) { this[mc].x-=Math.ceil(Math.random()*3); this[mc].y-=Math.ceil(Math.random()*3); } }else if(Dir == "down"){ for (i=0; i<4; i++) { this[mc].x+=Math.ceil(Math.random()*3); this[mc].y+=Math.ceil(Math.random()*3); } } }





Reply With Quote