Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. in my Main class I have:
  2.  
  3.        
  4.         private function bulletkill(obj:Bullet):void   
  5.             {
  6.                
  7.                
  8.            obj.removeChild(obj);
  9.         //  BulletList.splice(obj, 1);
  10.  
  11.    
  12.  
  13.             }
  14.        
  15.         //ENTERFRAME FUNCTION
  16.         function update(e:Event)
  17.             {      
  18.                 //move the ship
  19.                 ship.move(e);
  20.                
  21.                 //make the bullet move
  22.                 for each (bullet in BulletList)
  23.                 {
  24.  
  25.                         bullet.move(e);
  26.                         if (bullet.y > 100)
  27.                         bulletkill(bullet);
  28.  
  29.                 }
  30.  
  31. in my ship class i have:
  32.  
  33.     private var environment:Engine;
  34.  
  35.         if (key.isDown(Keyboard.SPACE)&& controlaBalas>8)
  36.                     {
  37.                         //create bullet
  38.                         var b:Bullet = new Bullet();
  39.                         //set pos
  40.                         b.x = this.x-4;
  41.                         b.y = this.y - 14;
  42.                         //control bullets
  43.                         controlaBalas = 0;
  44.                         //save into array
  45.                         //environment.BulletList.push(b);
  46.                
  47.                         environment.addChild(b);
  48.                        
  49.                         //go to stage
  50.                         //stage.addChild(b);
  51.                     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement