From f253fc1d55b9634f467377a8ab3461b2fdfbbfa4 Mon Sep 17 00:00:00 2001 From: davidovski Date: Mon, 22 Apr 2024 09:51:09 +0100 Subject: add level go --- level.go | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 level.go diff --git a/level.go b/level.go new file mode 100644 index 0000000..4c97f9d --- /dev/null +++ b/level.go @@ -0,0 +1,72 @@ +package main + +import ( + "fmt" +) + +func ReverseLevel(g *Game) { + fmt.Printf("pframe %d/%d\n", 0, len(g.playerAi)) + g.state = REVERSING + g.shaderName = "vcr" +} + +func playTheEnd(g *Game) { + g.animStart = g.time + g.state = END +} + +func afterReversed(g *Game) { + g.shaderName = "none" + g.ResetAll() + g.playerAiIdx = 0 + g.TransitionState() +} + +func levelStart(g *Game) { + + for _, o := range g.objects { + o.movable = false + } +} + +func StartLevel1(g *Game ) { + g.state = IN_GAME + + // when hit end + g.QueueState(func (g *Game){ + g.animStart = g.time + playTheEnd(g) + g.state = END + + }) + // after end + g.QueueState(ReverseLevel) + // after reversed + g.QueueState(afterReversed) + g.QueueState(StartLevel2) +} + +func StartLevel2(g *Game) { + g.state = PLACING + + g.toPlace = append(g.toPlace, NewLeftSpike(g, 0, 0)) + + // after end + g.QueueState(ReverseLevel) + // after reversed + g.QueueState(afterReversed) + g.QueueState(StartLevel3) +} + +func StartLevel3(g *Game) { + g.state = PLACING + + g.toPlace = append(g.toPlace, NewSpike(g, 0, 0)) + + // after end + g.QueueState(ReverseLevel) + // after reversed + g.QueueState(afterReversed) + g.QueueState(StartLevel3) +} + -- cgit v1.2.1