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
|
coyoteTimer int
|
||||||
jumpBuffer int
|
jumpBuffer int
|
||||||
noclip bool
|
noclip bool
|
||||||
|
spawnPoint geom.Int3
|
||||||
|
|
||||||
anims map[string]*engine.Anim
|
anims map[string]*engine.Anim
|
||||||
}
|
}
|
||||||
|
@ -104,8 +105,14 @@ func (aw *Awakeman) realUpdate() error {
|
||||||
runVelocity = sqrt2
|
runVelocity = sqrt2
|
||||||
coyoteTime = 5
|
coyoteTime = 5
|
||||||
jumpBufferTime = 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:
|
// High-school physics time! Under constant acceleration:
|
||||||
// v = v_0 + a*t
|
// v = v_0 + a*t
|
||||||
// and
|
// and
|
||||||
|
@ -224,14 +231,7 @@ func (aw *Awakeman) Prepare(game *engine.Game) error {
|
||||||
}
|
}
|
||||||
aw.toast = tst
|
aw.toast = tst
|
||||||
aw.anims = aw.Sprite.Sheet.NewAnims()
|
aw.anims = aw.Sprite.Sheet.NewAnims()
|
||||||
|
aw.spawnPoint = aw.Sprite.Actor.Pos
|
||||||
/*
|
|
||||||
idle_left
|
|
||||||
idle_right
|
|
||||||
run_left
|
|
||||||
run_right
|
|
||||||
run_vert
|
|
||||||
*/
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue