From a77fc96b2e5f125d5bb0e920fe60d8111f9a2b69 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 23 Apr 2024 19:05:02 +0100 Subject: add final level --- TODO | 2 +- level.go | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- levelgen.py | 47 ++++++++++++++++++++++--------- main.go | 12 ++++++++ objects.go | 2 +- 5 files changed, 139 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index 32a72b9..4455d74 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,7 @@ - [ ] add an actual ending - [ ] animateExit - [x] add voiceover -- [ ] add more levels +- [x] add more levels - [x] add more items - [x] add << and || on pause and play - [x] add menu diff --git a/level.go b/level.go index 883dea0..13937a6 100644 --- a/level.go +++ b/level.go @@ -298,7 +298,7 @@ func StartLevel6(g *Game) { g.QueueState(levelStart) - g.audioPlayer.voiceAudio[6].Play() + g.audioPlayer.voiceAudio[9].Play() g.toPlace = append(g.toPlace, NewHPlatform(g, 0, 0)) g.toPlace = append(g.toPlace, NewHPlatform(g, 0, 0)) @@ -376,6 +376,7 @@ func StartLevel7(g *Game) { g.toPlace = append(g.toPlace, NewRightSideSpring(g, 0, 0)) g.toPlace = append(g.toPlace, NewSpring(g, 0, 0)) + g.audioPlayer.voiceAudio[6].Play() // after end g.QueueState(ReverseLevel) // after reversed @@ -396,6 +397,7 @@ func StartLevel8(g *Game) { g.exit.x = 5 * tileSize g.exit.y = 1 * tileSize + g.audioPlayer.voiceAudio[7].Play() // after end g.QueueState(ReverseLevel) @@ -403,5 +405,93 @@ func StartLevel8(g *Game) { g.QueueState(func (g *Game){ afterReversed(g) }) - g.QueueState(StartLevel7) + g.QueueState(StartLevelFinal) +} +func StartLevelFinal(g *Game) { + g.SetPlacing() + //noMoveable(g) + + g.ClearAll() + 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, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +0, 0, 0, 0, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 0, 0, 0, 0, 0, +0, 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() + g.player.startx = 5 * tileSize + g.player.starty = 11 * tileSize + + g.exit.startx = 17 * tileSize + g.exit.starty = 11 * tileSize + g.exit.movable = true + + g.ResetAll() + g.playerAi = g.playerAi[:0] + + g.QueueState(levelStart) + + //g.audioPlayer.voiceAudio[3].Play() + g.toPlace = append(g.toPlace, NewBox(g, 0, 0)) + g.toPlace = append(g.toPlace, NewRightSideSpring(g, 0, 0)) + g.toPlace = append(g.toPlace, NewSpring(g, 0, 0)) + g.toPlace = append(g.toPlace, NewLeftSideSpring(g, 0, 0)) + g.toPlace = append(g.toPlace, NewVPlatform(g, 0, 0)) + + g.audioPlayer.voiceAudio[10].Play() + // after end + g.QueueState(ReverseLevel) + // after reversed + g.QueueState(afterReversed) + g.QueueState(StartLevelFinalMore) +} +func StartLevelFinalMore(g *Game) { + g.SetPlacing() + g.toPlace = append(g.toPlace, NewBox(g, 0, 0)) + g.toPlace = append(g.toPlace, NewSpring(g, 0, 0)) + g.toPlace = append(g.toPlace, NewSpike(g, 0, 0)) + + // after end + g.QueueState(ReverseLevel) + + // after reversed + g.QueueState(func (g *Game){ + afterReversed(g) + }) + g.QueueState(StartLevelFinalMore) } diff --git a/levelgen.py b/levelgen.py index 7e2e270..a17afd8 100755 --- a/levelgen.py +++ b/levelgen.py @@ -1,24 +1,43 @@ #!/usr/bin/env python array = [ - "#########################", - "#########################", - "#########################", - "#########################", - "#########################", - "#########################", - "#########################", " ", " ", " ", - " ##### ##### ", - " ##### ## ##### ", - " ##### ## ##### ", - " ##### ## ##### ", - " ##### ## ##### ", - " ##### ## ##### ", - " ##### ## ##### ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ###", + " ###", + "#### #####", + "#### #####", + "#### #####", + "#########################", + "#########################", ] #array = [ +# "#########################", +# "#########################", +# "#########################", +# "#########################", +# "#########################", +# "#########################", +# "#########################", +# " ", +# " ", +# " ", +# " ##### ##### ", +# " ##### ## ##### ", +# " ##### ## ##### ", +# " ##### ## ##### ", +# " ##### ## ##### ", +# " ##### ## ##### ", +# " ##### ## ##### ", +# ] +#array = [ # " ", # " ", # " ", diff --git a/main.go b/main.go index ba6b216..c1a8922 100644 --- a/main.go +++ b/main.go @@ -111,6 +111,14 @@ var ( voice6Ogg_src []byte //go:embed assets/vo/voice7.ogg voice7Ogg_src []byte + //go:embed assets/vo/voice8.ogg + voice8Ogg_src []byte + //go:embed assets/vo/voice9.ogg + voice9Ogg_src []byte + //go:embed assets/vo/voice10.ogg + voice10Ogg_src []byte + //go:embed assets/vo/voice11.ogg + voice11Ogg_src []byte ) var ( @@ -894,6 +902,10 @@ func (g *Game) LoadAudio() { voice5Ogg_src, voice6Ogg_src, voice7Ogg_src, + voice8Ogg_src, + voice9Ogg_src, + voice10Ogg_src, + voice11Ogg_src, }, g.audioPlayer.audioContext) } diff --git a/objects.go b/objects.go index 0dcbd67..a8f7be9 100644 --- a/objects.go +++ b/objects.go @@ -380,7 +380,7 @@ func NewExit(game *Game, x, y float32) *GameObject{ exit := NewObject(game, x, y) exit.images = []*ebiten.Image{ - tilesImage.SubImage(image.Rect(0, 16, 31, 48)).(*ebiten.Image), + tilesImage.SubImage(image.Rect(0, 16, 32, 48)).(*ebiten.Image), } exit.onCollideUp = OnCollideExit exit.onCollideDown = OnCollideExit -- cgit v1.2.1