summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-16 21:58:01 +0800
committerEltrac <hi@guhub.cn>2025-03-16 21:58:01 +0800
commit4e4570bfe15d3b842bb6608c9a4afaee4cd7d5ca (patch)
treea79b59f7622a04364cbfcacca215f0ca3fef82d6
parent8438119df461c675e5a9fedded980b6761976c44 (diff)
feat: gift heart now gives a random heart to player
-rw-r--r--data/bulletData.lua12
-rw-r--r--i18n/locales.lua6
-rw-r--r--resources/sound/gets_item.wavbin0 -> 226412 bytes
-rw-r--r--utils/audio.lua1
4 files changed, 17 insertions, 2 deletions
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
--- /dev/null
+++ b/resources/sound/gets_item.wav
Binary files 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"
}