From c73792133fafc80763297f99a6ca8ff28c2c43cb Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 23 Apr 2024 15:07:17 +0100 Subject: Tweak wait time --- assets/ambient.ogg | Bin 4605681 -> 4605365 bytes assets/land1.ogg | Bin 7658 -> 7072 bytes assets/land2.ogg | Bin 6857 -> 6368 bytes level.go | 5 ----- main.go | 11 ++++++----- objects.go | 6 +++--- 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/assets/ambient.ogg b/assets/ambient.ogg index b858738..d2bf7f1 100644 Binary files a/assets/ambient.ogg and b/assets/ambient.ogg differ diff --git a/assets/land1.ogg b/assets/land1.ogg index 6c71e18..10fb8a5 100644 Binary files a/assets/land1.ogg and b/assets/land1.ogg differ diff --git a/assets/land2.ogg b/assets/land2.ogg index af70def..58b0785 100644 Binary files a/assets/land2.ogg and b/assets/land2.ogg differ diff --git a/level.go b/level.go index 5baef9e..991e1fb 100644 --- a/level.go +++ b/level.go @@ -1,9 +1,5 @@ package main -import ( - "fmt" -) - func StartGame(g *Game) { //g.state = IN_GAME g.player = NewPlayer(g, 4 * tileSize, 9 * tileSize) @@ -17,7 +13,6 @@ func StartGame(g *Game) { func PauseScreen(g *Game) { g.SetPaused() - fmt.Printf("PAUSE\n", 0, len(g.playerAi)) } func ReverseLevel(g *Game) { diff --git a/main.go b/main.go index 90d5f97..5296557 100644 --- a/main.go +++ b/main.go @@ -33,9 +33,9 @@ const ( friction = 0.75 airResistance = 0.98 - endCardDuration = 200 + endCardDuration = 240 - exitTransitionWeight = 0.8 + exitTransitionWeight = 0.7 ghostAlpha = 0.5 hightlightBorder = 2 audioFadeIn = 0.999 @@ -43,6 +43,7 @@ const ( sampleRate = 44100 shadowOffset = 1 + killPlayerAfter = 80 musicLoopLength = 230 menuFadeInTime = 80 @@ -229,7 +230,7 @@ func (g * Game)ReplayPlayerAi() { } g.playerAiIdx += 1 - if g.playerAiIdx >= len(g.playerAi) * 2 { + if g.playerAiIdx >= len(g.playerAi) + killPlayerAfter { g.KillPlayer() } @@ -290,7 +291,7 @@ func (g *Game) Update() error { } if inpututil.IsMouseButtonJustReleased(ebiten.MouseButton0) { bo = buttonOffset - if onButton { + if onButton && g.animStart <= 0{ g.animStart = g.time + 60 StartGame(g) } @@ -445,7 +446,7 @@ func (g *Game) PlaceObject(cx, cy int) { g.objects = append(g.objects, placeable) g.toPlace = g.toPlace[1:len(g.toPlace)] - + placeable.PlayLand() if len(g.toPlace) == 0 && len(g.playerAi) == 0 { g.TransitionState() } diff --git a/objects.go b/objects.go index 141bf65..aca9209 100644 --- a/objects.go +++ b/objects.go @@ -159,8 +159,8 @@ func (o * GameObject) Update(tilemap Tilemap, others []*GameObject) { } if o.HasCollision(tilemap, others, direction) { - if ! o.onGround && o.vy > gravity*1210 { - o.playLand() + if ! o.onGround && o.vy > gravity*12 { + o.PlayLand() } o.onGround = true; o.vx *= o.friction @@ -264,7 +264,7 @@ func (object * GameObject) Collide(other *GameObject) bool { return ! ( minX2 >= maxX1 || maxX2 <= minX1 || minY2 >= maxY1 || maxY2 <= minY1) } -func (object *GameObject) playLand() { +func (object *GameObject) PlayLand() { jumpid := rand.IntN(2) object.game.audioPlayer.landAudio[jumpid].Rewind() object.game.audioPlayer.landAudio[jumpid].Play() -- cgit v1.2.1