Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package shooter.entities;
- import java.awt.Graphics2D;
- import java.awt.geom.Ellipse2D;
- import java.awt.geom.RectangularShape;
- import shooter.gfx.ObjectSpriteManager;
- import shooter.input.MouseInputHandler;
- import shooter.main.Game;
- public abstract class GameObject {
- // Object x-position
- protected double x;
- // Object y-position
- protected double y;
- // Object x-velocity
- protected double velX;
- // Object y-velocity
- protected double velY;
- // Object rotation
- protected double rotation;
- // Object health
- protected double health;
- // Collision Shape
- protected RectangularShape col;
- // Handles the Object Sprites
- protected ObjectSpriteManager om;
- // MouseInputHandler instance
- protected MouseInputHandler mi;
- // Instance of Game
- Game game;
- public GameObject(double x, double y, double health, ObjectSpriteManager om, MouseInputHandler mi, Game game) {
- this.x = x;
- this.y = y;
- this.health = health;
- this.om = om;
- this.mi = mi;
- this.game = game;
- col = new Ellipse2D.Double(x, y, ObjectSpriteManager.SIZE, ObjectSpriteManager.SIZE);
- }
- public double getRotation() {
- return rotation;
- }
- public void setRotation(double rotation) {
- this.rotation = rotation;
- }
- public double getVelX() {
- return velX;
- }
- public void setVelX(double i) {
- velX = i;
- }
- public double getVelY() {
- return velY;
- }
- public void setVelY(double i) {
- velY = i;
- }
- public double getX() {
- return x;
- }
- public double getY() {
- return y;
- }
- public RectangularShape getCol() {
- return col;
- }
- public abstract void tick();
- public abstract void render(Graphics2D g2d);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement