summaryrefslogtreecommitdiff
path: root/level.go
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2024-04-22 11:49:52 +0100
committerdavidovski <david@davidovski.xyz>2024-04-22 11:49:52 +0100
commit63253bbeb5c6a6a346443483bddc75276625d48a (patch)
treef9b782b37fd0ff3d72468e989055ff88a4ffe681 /level.go
parentf253fc1d55b9634f467377a8ab3461b2fdfbbfa4 (diff)
go into the hole
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)
+}
+
+func StartLevel4(g *Game) {
+ g.SetPlacing()
+ g.toPlace = append(g.toPlace, NewSpring(g, 0, 0))
+
+ g.ClearAll()
+ tilemap := NewTilemap([][]int{
+ {
+ 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, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5,
+ 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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, 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)
+}