Guest User

Untitled

a guest
Mar 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. bullets.add(new Bullet(x + 15, y + 15, (float) Math.atan2(input.getMouseY() - 1 - (y + 16),input.getMouseX() - 1 - (x + 16)),"normal"));
  2.  
  3. +16 is half of the size of the main player
  4. -1 for some reason
  5. +15 for some other reason.
  6.  
  7. new Bullet(playerx+(plaayerwidth/2)-1,playery+(plaayerheight/2)-1, maths to work out direction, type fo bullet)
  8.  
  9. public Bullet(float posx, float posy, float direction, String type){
  10.     this.posx = posx;
  11.     this.posy = posy;
  12.     this.type = type;
  13.     this.direction = direction;
  14.  
  15.     thecircle = new Circle(posx, posy, 2);
  16.    
  17. }
  18. moving:
  19.  
  20. posx += Math.cos(direction) * MainGameState.bulletspeed;
  21.     posy += Math.sin(direction) * MainGameState.bulletspeed;
  22.     thecircle.setLocation(posx, posy);
Add Comment
Please, Sign In to add comment