1
0
Fork 0

feat: add sound on shape locked and row clear

This commit is contained in:
Henrik Hautakoski 2025-09-21 11:11:47 +02:00
parent 173adadb84
commit a5c9e687ee

View file

@ -43,6 +43,8 @@ func SpawnShape() {
}
func LockShape() {
audio.Play(assets.SFX_SHAPE_LOCKED)
for _, block := range shape.Coordinates() {
block = shape_pos.Add(block)
// Check bounds
@ -86,7 +88,11 @@ func Update(delta float32) {
// Update position if it does not collide
if game.CheckShapeCollision(new_pos, &shape, &grid) {
LockShape()
score.Lines(grid.ClearFullRows())
num_rows := grid.ClearFullRows()
if num_rows > 0 {
audio.Play(assets.SFX_ROW_CLEARED)
score.Lines(num_rows)
}
SpawnShape()
} else {
shape_pos = new_pos