Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.64 KB | None | 0 0
  1. package shooter.entities;
  2.  
  3. import java.awt.Graphics2D;
  4. import java.awt.geom.Ellipse2D;
  5. import java.awt.geom.RectangularShape;
  6.  
  7. import shooter.gfx.ObjectSpriteManager;
  8. import shooter.input.MouseInputHandler;
  9. import shooter.main.Game;
  10.  
  11. public abstract class GameObject {
  12.  
  13.     // Object x-position
  14.     protected double x;
  15.     // Object y-position
  16.     protected double y;
  17.     // Object x-velocity
  18.     protected double velX;
  19.     // Object y-velocity
  20.     protected double velY;
  21.     // Object rotation
  22.     protected double rotation;
  23.     // Object health
  24.     protected double health;
  25.     // Collision Shape
  26.     protected RectangularShape col;
  27.     // Handles the Object Sprites
  28.     protected ObjectSpriteManager om;
  29.     // MouseInputHandler instance
  30.     protected MouseInputHandler mi;
  31.     // Instance of Game
  32.     Game game;
  33.  
  34.     public GameObject(double x, double y, double health, ObjectSpriteManager om, MouseInputHandler mi, Game game) {
  35.         this.x = x;
  36.         this.y = y;
  37.         this.health = health;
  38.         this.om = om;
  39.         this.mi = mi;
  40.         this.game = game;
  41.         col = new Ellipse2D.Double(x, y, ObjectSpriteManager.SIZE, ObjectSpriteManager.SIZE);
  42.     }
  43.    
  44.     public double getRotation() {
  45.         return rotation;
  46.     }
  47.  
  48.     public void setRotation(double rotation) {
  49.         this.rotation = rotation;
  50.     }
  51.  
  52.     public double getVelX() {
  53.         return velX;
  54.     }
  55.  
  56.     public void setVelX(double i) {
  57.         velX = i;
  58.     }
  59.  
  60.     public double getVelY() {
  61.         return velY;
  62.     }
  63.  
  64.     public void setVelY(double i) {
  65.         velY = i;
  66.     }
  67.    
  68.     public double getX() {
  69.         return x;
  70.     }
  71.  
  72.     public double getY() {
  73.         return y;
  74.     }
  75.  
  76.     public RectangularShape getCol() {
  77.         return col;
  78.     }
  79.  
  80.     public abstract void tick();
  81.  
  82.     public abstract void render(Graphics2D g2d);
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement