blob: 4c97f9d37a22ac8cff84cf5f5082d5be72f7d049 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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)
}
|