From 4e4570bfe15d3b842bb6608c9a4afaee4cd7d5ca Mon Sep 17 00:00:00 2001 From: Eltrac Date: Sun, 16 Mar 2025 21:58:01 +0800 Subject: feat: gift heart now gives a random heart to player --- data/bulletData.lua | 12 ++++++++++++ i18n/locales.lua | 6 ++++-- resources/sound/gets_item.wav | Bin 0 -> 226412 bytes utils/audio.lua | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 resources/sound/gets_item.wav diff --git a/data/bulletData.lua b/data/bulletData.lua index 3fc1364..fa3e7a6 100644 --- a/data/bulletData.lua +++ b/data/bulletData.lua @@ -1,6 +1,7 @@ local enemyData = require "data.enemyData" local enemies = require "logic.enemies" local audio = require "utils.audio" +local translator = require "i18n.translator" local bulletData = { redheart = { @@ -109,6 +110,17 @@ local bulletData = { audio.play("hitGlass") end end + }, + giftheart = { + damage = 0, + afterShot = function () + local heartTypes = require "data.heartTypes" + speaker.speak(translator.T("giftHeartSpeech")) + table.insert(G.player.hearts, utils.any(heartTypes)) + audio.play("getsItem") + end, + afterHit = function (x, y, enemyType) + end } } diff --git a/i18n/locales.lua b/i18n/locales.lua index bc9c289..2265cb0 100644 --- a/i18n/locales.lua +++ b/i18n/locales.lua @@ -11,7 +11,8 @@ local locales = { "good luck" }, roomCleared = "Room cleared: ", - waveStart = "New enemies are coming." + waveStart = "New enemies are coming.", + giftHeartSpeech = "You've received a gift!" }, zh = { newRealm = "你进入了新的领域,没有回头路了", @@ -25,7 +26,8 @@ local locales = { "祝你好运" }, roomCleared = "已清理房间:", - waveStart = "有人来了" + waveStart = "有人来了", + giftHeartSpeech = "你收到了礼物!" } } diff --git a/resources/sound/gets_item.wav b/resources/sound/gets_item.wav new file mode 100644 index 0000000..9a5674f Binary files /dev/null and b/resources/sound/gets_item.wav differ diff --git a/utils/audio.lua b/utils/audio.lua index 5cd4b33..dd80daa 100644 --- a/utils/audio.lua +++ b/utils/audio.lua @@ -8,6 +8,7 @@ local soundResources = { levelComplete = "level_complete.wav", warning = "warning.wav", getsHit = "gets_hit.wav", + getsItem = "gets_item.wav", punch = "punch.wav", door = "door.wav" } -- cgit v1.2.3