Guest User

Untitled

a guest
Feb 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. # Ur den generella klassen för alla objekt i spelet
  2.  
  3. public class GameObject {
  4. private double x, y;
  5. private double xv, yv;
  6. private int width, height;
  7. private GameWorld world;
  8.  
  9. public GameObject(double x, double y, double xv, double yv, int width, int height, GameWorld world) {
  10. this.x = x;
  11. this.y = y;
  12. this.xv = xv;
  13. this.yv = yv;
  14. this.width = width;
  15. this.height = height;
  16. this.world = world;
  17. }
  18.  
  19. public void move() {
  20. x += xv;
  21. y += yv;
  22. }
  23.  
  24. # Klass som alla fiender ärver från
  25.  
  26. public class Enemy extends GameObject {
  27. private GameWorld world;
  28.  
  29. public Enemy(double x, double y, double xv, double yv, int width, int height, GameWorld world) {
  30. super(x, y, xv, yv, width, height, world);
  31. this.world = world;
  32. }
  33.  
  34.  
  35. # Klass för fienden helikopter
  36.  
  37. public class Helicopter extends Enemy {
  38.  
  39. public Helicopter(double x, double y, double xv, double yv, GameWorld world) {
  40. super(x, y, xv, yv, 64, 32, world);
  41. }
Add Comment
Please, Sign In to add comment