feat: add sound on shape locked and row clear
This commit is contained in:
parent
173adadb84
commit
a5c9e687ee
1 changed files with 7 additions and 1 deletions
8
main.go
8
main.go
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue