summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2024-04-23 20:19:19 +0100
committerdavidovski <david@davidovski.xyz>2024-04-23 20:19:19 +0100
commit684cda2b9f0e35519f8640ea686f9e8c805adfc4 (patch)
tree9c9fa540eee724cac44c0d1c69785e7467722398 /main.go
parent7a7efefdf85ff8d6b73dcbbfbd350a357bf204cf (diff)
make fallen off objects come back
Diffstat (limited to 'main.go')
-rw-r--r--main.go11
1 files changed, 10 insertions, 1 deletions
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
}