laneya2

cave exploration game
git clone https://git.ce9e.org/laneya2.git

commit
becc1d975349c9667c907e0c98a1ddeb135b9903
parent
dc752424237ab0679ce7ed34fe8952eb1856c3c0
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-09-28 16:31
refactor: turn health into uint

Diffstat

M player.go 7 ++++---

1 files changed, 4 insertions, 3 deletions


diff --git a/player.go b/player.go

@@ -10,8 +10,8 @@ type Player struct {
   10    10 	Id          int
   11    11 	Pos         Point
   12    12 	Speed       float32
   13    -1 	Health      int
   14    -1 	HealthTotal int
   -1    13 	Health      uint
   -1    14 	HealthTotal uint
   15    15 }
   16    16 
   17    17 type PlayerMessage struct {
@@ -39,7 +39,8 @@ func (player *Player) Move(dir string) {
   39    39 	}
   40    40 }
   41    41 
   42    -1 func (player *Player) TakeDamage(amount int) {
   -1    42 func (player *Player) TakeDamage(amount uint) {
   -1    43 	// TODO: death if amount >= player.Health
   43    44 	player.Health -= amount
   44    45 	player.Game.broadcast([]Message{
   45    46 		Message{