Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- in my Main class I have:
- private function bulletkill(obj:Bullet):void
- {
- removeChild(obj);
- // BulletList.splice(obj, 1);
- }
- //ENTERFRAME FUNCTION
- function update(e:Event)
- {
- //move the ship
- ship.move(e);
- //make the bullet move
- for each (bullet in BulletList)
- {
- bullet.move(e);
- if (bullet.y > 100)
- bulletkill(bullet);
- }
- in my ship class i have:
- private var environment:Engine;
- if (key.isDown(Keyboard.SPACE)&& controlaBalas>8)
- {
- //create bullet
- var b:Bullet = new Bullet();
- //set pos
- b.x = this.x-4;
- b.y = this.y - 14;
- //control bullets
- controlaBalas = 0;
- //save into array
- //environment.BulletList.push(b);
- environment.addChild(b);
- //go to stage
- //stage.addChild(b);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement