summaryrefslogtreecommitdiff
path: root/level.go
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2024-04-22 09:51:09 +0100
committerdavidovski <david@davidovski.xyz>2024-04-22 09:51:09 +0100
commitf253fc1d55b9634f467377a8ab3461b2fdfbbfa4 (patch)
tree049fabad5b702795bf6abaa2c399440c92d6be68 /level.go
parent1e203b251c36895781b868ce1b27d5151d54a26d (diff)
add level go
Diffstat (limited to 'level.go')
-rw-r--r--level.go72
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)
+}
+