Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ur den generella klassen för alla objekt i spelet
- public class GameObject {
- private double x, y;
- private double xv, yv;
- private int width, height;
- private GameWorld world;
- public GameObject(double x, double y, double xv, double yv, int width, int height, GameWorld world) {
- this.x = x;
- this.y = y;
- this.xv = xv;
- this.yv = yv;
- this.width = width;
- this.height = height;
- this.world = world;
- }
- public void move() {
- x += xv;
- y += yv;
- }
- # Klass som alla fiender ärver från
- public class Enemy extends GameObject {
- private GameWorld world;
- public Enemy(double x, double y, double xv, double yv, int width, int height, GameWorld world) {
- super(x, y, xv, yv, width, height, world);
- this.world = world;
- }
- # Klass för fienden helikopter
- public class Helicopter extends Enemy {
- public Helicopter(double x, double y, double xv, double yv, GameWorld world) {
- super(x, y, xv, yv, 64, 32, world);
- }
Add Comment
Please, Sign In to add comment