Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. package lesson1GameObjectsTask;
  2.  
  3. public class Bullet {
  4. private int x;
  5. private int y;
  6.  
  7. private int speed;
  8.  
  9. private int direction;
  10.  
  11. public Bullet() {
  12. direction = 1;
  13.  
  14. parking();
  15. speed = 5;
  16. }
  17.  
  18. public Bullet(int x, int y, int direction) {
  19. this.x = x;
  20. this.y = y;
  21.  
  22. this.direction = direction;
  23.  
  24. parking();
  25. speed = 5;
  26. }
  27.  
  28. void parking() {
  29. x = -100;
  30. y = -100;
  31. }
  32.  
  33. void updateX(int deltaX) {
  34. x += deltaX;
  35. }
  36.  
  37. void updateY(int deltaY) {
  38. y += deltaY;
  39. }
  40.  
  41. //getters & setters
  42.  
  43. public int getX() {
  44. return x;
  45. }
  46.  
  47. public int getY() {
  48. return y;
  49. }
  50.  
  51. public int getSpeed() {
  52. return speed;
  53. }
  54.  
  55. public int getDirection() {
  56. return direction;
  57. }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement