summaryrefslogtreecommitdiff
path: root/level.go
diff options
context:
space:
mode:
Diffstat (limited to 'level.go')
-rw-r--r--level.go91
1 files changed, 84 insertions, 7 deletions
diff --git a/level.go b/level.go
index 4c97f9d..2199a37 100644
--- a/level.go
+++ b/level.go
@@ -6,8 +6,7 @@ import (
func ReverseLevel(g *Game) {
fmt.Printf("pframe %d/%d\n", 0, len(g.playerAi))
- g.state = REVERSING
- g.shaderName = "vcr"
+ g.SetReversing()
}
func playTheEnd(g *Game) {
@@ -23,14 +22,40 @@ func afterReversed(g *Game) {
}
func levelStart(g *Game) {
-
+ g.ResetAll()
+ g.playerAiIdx = 0
+ g.SetInGame()
for _, o := range g.objects {
o.movable = false
}
}
func StartLevel1(g *Game ) {
- g.state = IN_GAME
+ g.SetInGame()
+
+ tilemap := NewTilemap([][]int{
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 0,
+ 0, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 0,
+ 0, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ },
+ }, 25)
+
+ g.tilemap = &tilemap
+ g.tilemap.UpdateSurface()
// when hit end
g.QueueState(func (g *Game){
@@ -47,7 +72,7 @@ func StartLevel1(g *Game ) {
}
func StartLevel2(g *Game) {
- g.state = PLACING
+ g.SetPlacing()
g.toPlace = append(g.toPlace, NewLeftSpike(g, 0, 0))
@@ -59,7 +84,7 @@ func StartLevel2(g *Game) {
}
func StartLevel3(g *Game) {
- g.state = PLACING
+ g.SetPlacing()
g.toPlace = append(g.toPlace, NewSpike(g, 0, 0))
@@ -67,6 +92,58 @@ func StartLevel3(g *Game) {
g.QueueState(ReverseLevel)
// after reversed
g.QueueState(afterReversed)
- g.QueueState(StartLevel3)
+ g.QueueState(StartLevel4)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5, 5, 5, 5, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ },
+ }, 25)
+
+ g.tilemap = &tilemap
+ g.tilemap.UpdateSurface()
+ g.exit.startx = 20 * tileSize
+ g.exit.starty = 5 * tileSize
+
+ g.ResetAll()
+ g.playerAi = g.playerAi[:0]
+
+ g.QueueState(levelStart)
+ // after end
+ g.QueueState(ReverseLevel)
+ // after reversed
+ g.QueueState(afterReversed)
+ g.QueueState(StartLevel5)
}
+func StartLevel5(g *Game) {
+ g.SetPlacing()
+ g.toPlace = append(g.toPlace, NewSpike(g, 0, 0))
+
+ // after end
+ g.QueueState(ReverseLevel)
+ // after reversed
+ g.QueueState(afterReversed)
+ g.QueueState(StartLevel5)
+}