diff options
author | heav <hheav3@gmail.com> | 2023-03-28 06:38:17 +0000 |
---|---|---|
committer | heav <hheav3@gmail.com> | 2023-03-28 06:38:17 +0000 |
commit | b509373d52646702dd1e98f576ca365870911f04 (patch) | |
tree | 777dbc3242f5f0a792de6778b32aaece6b5600da | |
parent | f73ca01a32d8b2276418c30e8324c390fb396828 (diff) |
more sound effects.
-rw-r--r-- | assets/tspin.mp3 | bin | 0 -> 13770 bytes | |||
-rw-r--r-- | assets/tspinkick5.mp3 | bin | 0 -> 17006 bytes | |||
-rw-r--r-- | game/init.lua | 12 | ||||
-rw-r--r-- | game/sfx.lua | 1 |
4 files changed, 13 insertions, 0 deletions
diff --git a/assets/tspin.mp3 b/assets/tspin.mp3 Binary files differnew file mode 100644 index 0000000..22d979c --- /dev/null +++ b/assets/tspin.mp3 diff --git a/assets/tspinkick5.mp3 b/assets/tspinkick5.mp3 Binary files differnew file mode 100644 index 0000000..b8b2fb0 --- /dev/null +++ b/assets/tspinkick5.mp3 diff --git a/game/init.lua b/game/init.lua index 386a7c4..085b0e8 100644 --- a/game/init.lua +++ b/game/init.lua @@ -60,8 +60,10 @@ function M:input_loop() while self.piece:move(-1, 0) do end elseif key == "up" then moved = self.piece:rotate() + if moved then self:on_rotated() end elseif key == "lctrl" then moved = self.piece:rotate(true) + if moved then self:on_rotated() end elseif key == "space" then local dropped = false while self.piece:move(-1, 0) do @@ -98,6 +100,16 @@ function M:input_loop() return loop end +function M:on_rotated() + if self.piece.t_spun then + if self.piece.last_kick_id == 5 then + sfx.play("tspinkick5") + else + sfx.play("tspin") + end + end +end + function M:place_piece() if not self.piece:can_move(-1, 0) then self.piece:place() diff --git a/game/sfx.lua b/game/sfx.lua index cd6ae2e..261e6a5 100644 --- a/game/sfx.lua +++ b/game/sfx.lua @@ -1,6 +1,7 @@ local sounds = { "harddrop", "tspinsingle", "tspindouble", "tspintriple", + "tspin", "tspinkick5", } local sources = {} |