respawn
This commit is contained in:
parent
247caa1373
commit
cdc9337df5
1 changed files with 8 additions and 8 deletions
16
game/aw.go
16
game/aw.go
|
@ -37,6 +37,7 @@ type Awakeman struct {
|
|||
coyoteTimer int
|
||||
jumpBuffer int
|
||||
noclip bool
|
||||
spawnPoint geom.Int3
|
||||
|
||||
anims map[string]*engine.Anim
|
||||
}
|
||||
|
@ -104,8 +105,14 @@ func (aw *Awakeman) realUpdate() error {
|
|||
runVelocity = sqrt2
|
||||
coyoteTime = 5
|
||||
jumpBufferTime = 5
|
||||
respawnY = 1000
|
||||
)
|
||||
|
||||
// Fell below some threshold?
|
||||
if aw.Sprite.Actor.Pos.Y > respawnY {
|
||||
aw.Sprite.Actor.Pos = aw.spawnPoint
|
||||
}
|
||||
|
||||
// High-school physics time! Under constant acceleration:
|
||||
// v = v_0 + a*t
|
||||
// and
|
||||
|
@ -224,14 +231,7 @@ func (aw *Awakeman) Prepare(game *engine.Game) error {
|
|||
}
|
||||
aw.toast = tst
|
||||
aw.anims = aw.Sprite.Sheet.NewAnims()
|
||||
|
||||
/*
|
||||
idle_left
|
||||
idle_right
|
||||
run_left
|
||||
run_right
|
||||
run_vert
|
||||
*/
|
||||
aw.spawnPoint = aw.Sprite.Actor.Pos
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue