diff options
author | davidovski <david@davidovski.xyz> | 2024-04-23 20:19:19 +0100 |
---|---|---|
committer | davidovski <david@davidovski.xyz> | 2024-04-23 20:19:19 +0100 |
commit | 684cda2b9f0e35519f8640ea686f9e8c805adfc4 (patch) | |
tree | 9c9fa540eee724cac44c0d1c69785e7467722398 /main.go | |
parent | 7a7efefdf85ff8d6b73dcbbfbd350a357bf204cf (diff) |
make fallen off objects come back
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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 } |