This commit is contained in:
Josh Deprez 2021-09-09 11:12:07 +10:00
parent 247caa1373
commit cdc9337df5

View file

@ -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
} }