New player class inherits from Mob

This commit is contained in:
jordan4ibanez 2022-08-01 20:43:42 -04:00
parent 1c132bc820
commit db830f4532

View File

@ -0,0 +1,37 @@
module entity.player.player;
import std.stdio;
import entity.mob.mob;
// A player. This is not a static object because: Multiplayer
// Inherits from mob to allow full compatibility between them
public class Player : Mob {
// Players have a UUID (uninitialized), but their name is how they're identified
private string name;
this() {
// Player's do not call down the super chain
this.setHealth(20);
}
override void onSpawn() {
writeln("I'm alive! I'm born!");
}
override void onTick(double delta) {
}
override void onHurt() {
}
override void onDeath() {
writeln("Mama mia!");
}
override void onDeathPoof() {
}
}