47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
package de.samdev.colorrunner.game.world.entities;
|
|
|
|
import com.badlogic.gdx.graphics.Texture;
|
|
import com.badlogic.gdx.math.Rectangle;
|
|
import com.badlogic.gdx.math.Vector2;
|
|
|
|
import de.samdev.colorrunner.game.world.CRGameWorld;
|
|
|
|
public abstract class CRGameEntity {
|
|
|
|
protected CRGameWorld world;
|
|
|
|
public Rectangle bounds = new Rectangle();
|
|
public float visualRotation = 0f; // 0..360
|
|
public float visualZoomX = 1f; // 0..360
|
|
public float visualZoomY = 1f; // 0..360
|
|
|
|
public boolean active = false; // true ::= marked for removal
|
|
|
|
protected Vector2 tmp_pos = new Vector2();
|
|
|
|
public CRGameEntity(CRGameWorld _owner, float width, float height) {
|
|
this(_owner, 0, 0, width, height);
|
|
}
|
|
|
|
public CRGameEntity(CRGameWorld _owner, float x, float y, float width, float height) {
|
|
active = true;
|
|
|
|
bounds = new Rectangle(x, y, width, height);
|
|
world = _owner;
|
|
}
|
|
|
|
public Vector2 getPosition() {
|
|
return bounds.getPosition(tmp_pos);
|
|
}
|
|
|
|
public void remove() {
|
|
active = false;
|
|
}
|
|
|
|
public abstract void update(float delta);
|
|
|
|
public abstract Texture getTexture();
|
|
|
|
public abstract boolean canCollide(boolean actualCollision, CRGameEntity collider);
|
|
}
|