Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1.  
  2. import java.awt.Image;
  3.  
  4. public class Enemy {
  5.  
  6. private float x, y, vx, vy;
  7. private Image i;
  8. private Level l;
  9.  
  10. // constructor
  11. public Enemy(Image i, float x, float y, Level l) {
  12. this.i = i;
  13. this.x = (int) (750 * Math.random());
  14. this.y = y;
  15. this.l = l;
  16. }
  17.  
  18. // get x position
  19. public float getX() {
  20. return x;
  21. }
  22.  
  23. // get y position
  24. public float getY() {
  25. return y;
  26. }
  27.  
  28. // set Enemy x position
  29. public void setX(float x) {
  30. this.x = x;
  31. }
  32.  
  33. // set Enemy y position
  34. public void setY(float y) {
  35. this.y = y;
  36. }
  37.  
  38. // get horizontal velocity
  39. public float getVelocityX() {
  40. return vx;
  41. }
  42.  
  43. // get vertical velocity
  44. public float getVelocityY() {
  45. return vy;
  46. }
  47.  
  48. // set horizontal velocity
  49. public void setVelocityX(float vx) {
  50. this.vx = vx;
  51. }
  52.  
  53. // set vertical velocity
  54. public void setVelocityY(float vy) {
  55. this.vy = vy;
  56. }
  57.  
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement