New player class inherits from Mob
This commit is contained in:
parent
1c132bc820
commit
db830f4532
37
source/entity/player/player.d
Normal file
37
source/entity/player/player.d
Normal 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() {
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user