diff options
-rw-r--r-- | level.go | 72 |
1 files changed, 72 insertions, 0 deletions
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) +} + |