//rocket - Update Every Frame //set up all keypress variables var leftPressed = isKeyPressed(Keys.leftArrow); var rightPressed = isKeyPressed(Keys.rightArrow); var upPressed = isKeyPressed(Keys.upArrow); var spacePressed = isKeyPressed(Keys.space); var bullet = $this.findName("bullet"); //keypress conditionals if(spacePressed){ //bullet.moving = true; if(!$this.scene.projectile) { var b = bullet.clone(true, true, $this.scene); b.x(bullet.getStagePos().x); b.y(bullet.getStagePos().y); b.rotation($this.rotation()); b.moving = true; b.z(1000); $this.scene.projectile = b; } } if(upPressed){ $this.moveForwardByRotation(); } if(leftPressed){ $this.spin(-40); } if(rightPressed){ $this.spin(40); } // if($this.y()>600){ $this.y(0); } if($this.y()<0){ $this.y(600); } if($this.x()>800){ $this.x(0); } if($this.x()<0){ $this.x(800); } //meteor - Initialize When Scene Starts var rot = random(359); $this.rotation(rot);