From cffac12303402c3bfd2d7eb8ab982bdaa86bd72d Mon Sep 17 00:00:00 2001 From: davidovski Date: Sun, 21 Apr 2024 23:07:10 +0100 Subject: hold r to rewind --- main.go | 11 ++++++----- objects.go | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index 6438fa4..2153470 100644 --- a/main.go +++ b/main.go @@ -164,15 +164,16 @@ func (g *Game) Init() { func (g *Game) Update() error { g.time += 1 - if inpututil.IsKeyJustPressed(ebiten.KeyR) { + if ebiten.IsKeyPressed(ebiten.KeyR) { + if g.state == IN_GAME { + g.state = REVERSING + g.shaderName = "vcr" + } + } else { if g.state == REVERSING { g.state = IN_GAME g.shaderName = "none" - } else if g.state == IN_GAME { - g.state = REVERSING - g.shaderName = "vcr" } - } if g.state == IN_GAME { diff --git a/objects.go b/objects.go index 0bc8b62..e24e331 100644 --- a/objects.go +++ b/objects.go @@ -225,7 +225,9 @@ func OnCollideSpring(this, other *GameObject) bool { } func OnCollideSpike(this, other *GameObject) bool { - other.game.ResetAll() + if other == this.game.player { + other.game.ResetAll() + } return true } -- cgit v1.2.1