52 lines
1.2 KiB
Java
52 lines
1.2 KiB
Java
import processing.core.PApplet;
|
|
|
|
/**
|
|
* Class from which we define all other Entities which are seen in the game.
|
|
*/
|
|
public class Character {
|
|
Fenster window;
|
|
String type;
|
|
int color;
|
|
boolean collidable;
|
|
float x, y;
|
|
|
|
Character (Fenster window, String type) {
|
|
this.window = window;
|
|
this.type = type;
|
|
this.collidable = true;
|
|
this.color = 0;
|
|
}
|
|
|
|
Character (Fenster window, String type, int color) {
|
|
this.window = window;
|
|
this.type = type;
|
|
this.color = color;
|
|
this.collidable = true;
|
|
}
|
|
|
|
Character (Fenster window, String type, int color, boolean collidable) {
|
|
this.window = window;
|
|
this.type = type;
|
|
this.color = color;
|
|
this.collidable = collidable;
|
|
}
|
|
|
|
Character (Character another) {
|
|
this.window = another.window;
|
|
this.type = another.type;
|
|
this.collidable = another.collidable;
|
|
this.color = another.color;
|
|
}
|
|
|
|
public Character(Fenster window) {
|
|
this.window = window;
|
|
}
|
|
|
|
public void draw(float x, float y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
window.fill(color);
|
|
window.text(type, x * window.tilewidth/2, y * window.tilewidth/2);
|
|
}
|
|
}
|