Advertisement
Guest User

Untitled

a guest
Jul 5th, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. public function addenemy():void
  2. {
  3. var mob:MC_enemy1 = new MC_enemy1();
  4. enemy.push(mob);
  5. stage.addChild(mob);
  6. mob.x = 800 + mob.width;
  7. mob.y = mob.height + Math.random() * 601 - mob.height;
  8. }
  9. public function shoot():void
  10. {
  11. var bullet:Sprite = drawcircle(0x0000ff,2);
  12. stage.addChild(bullet);
  13. bullet.x = hero.x;
  14. bullet.y = hero.y;
  15. bullets.push(bullet);
  16. }
  17. public function bulletmovement():void
  18. {
  19. for(var j:int = 0 ; j < bullets.length ; j++)
  20. {
  21. bullets[j].x += bulletspeed;
  22. if(bullets[j].x >= 800 && stage.contains(bullets[j]) == true)
  23. {
  24. stage.removeChild(bullets[j]);
  25. bullets.splice(j,1);
  26. break
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement