From 684cda2b9f0e35519f8640ea686f9e8c805adfc4 Mon Sep 17 00:00:00 2001 From: davidovski Date: Tue, 23 Apr 2024 20:19:19 +0100 Subject: make fallen off objects come back --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'main.go') diff --git a/main.go b/main.go index 31d2310..44e0170 100644 --- a/main.go +++ b/main.go @@ -38,7 +38,7 @@ const ( ghostAlpha = 0.5 hightlightBorder = 2 audioFadeIn = 0.99 - musicVolume = 0.2 + musicVolume = 0.5 sampleRate = 44100 shadowOffset = 1 @@ -49,6 +49,8 @@ const ( menuFadeInTime = 80 buttonOffset = 4.0 buttonOffsetPressed = 2.0 + + masterVolume = 6.0 ) var ( @@ -423,6 +425,10 @@ func (g *Game) Update() error { func (g *Game) UpdatePlacing() { for _, obj := range g.objects { obj.Update(*g.tilemap, g.objects) + if obj.y > screenHeight { + g.toPlace = append(g.toPlace, obj) + g.RemoveObject(obj) + } } g.tilemap.Update() @@ -848,6 +854,7 @@ func loadAudiosVorbis(oggFiles [][]byte, audioContext *audio.Context) []*audio.P if err != nil { return nil } + p.SetVolume(p.Volume()*masterVolume) players = append(players, p) } return players @@ -866,6 +873,7 @@ func loadAudioVorbis(oggFile []byte, audioContext *audio.Context) *audio.Player if err != nil { return nil } + p.SetVolume(p.Volume()*masterVolume) return p } func loadAudio(wavFile []byte, audioContext *audio.Context) *audio.Player { @@ -881,6 +889,7 @@ func loadAudio(wavFile []byte, audioContext *audio.Context) *audio.Player { if err != nil { return nil } + p.SetVolume(p.Volume()*masterVolume) return p } -- cgit v1.2.1