mirror of
https://github.com/libretro/lutro-platformer.git
synced 2025-02-17 07:18:27 +00:00
Add hit sfx, and display current HP
This commit is contained in:
parent
aaeb2eaeb6
commit
4e6759c030
BIN
assets/hit.wav
Executable file
BIN
assets/hit.wav
Executable file
Binary file not shown.
4
main.lua
4
main.lua
@ -25,6 +25,7 @@ function lutro.load()
|
||||
camera_x = 0
|
||||
camera_y = 0
|
||||
gold = 0
|
||||
hp = 3
|
||||
lutro.graphics.setBackgroundColor(0, 0, 0)
|
||||
bg1 = lutro.graphics.newImage("assets/forestbackground.png")
|
||||
bg2 = lutro.graphics.newImage("assets/foresttrees.png")
|
||||
@ -37,6 +38,7 @@ function lutro.load()
|
||||
sfx_coin = lutro.audio.newSource("assets/coin.wav")
|
||||
sfx_jump = lutro.audio.newSource("assets/jump.wav")
|
||||
sfx_step = lutro.audio.newSource("assets/step.wav")
|
||||
sfx_hit = lutro.audio.newSource("assets/hit.wav")
|
||||
|
||||
ninja = newNinja()
|
||||
table.insert(entities, ninja)
|
||||
@ -74,5 +76,5 @@ function lutro.draw()
|
||||
|
||||
lutro.graphics.pop()
|
||||
|
||||
lutro.graphics.print("G" .. gold, 3, 1)
|
||||
lutro.graphics.print("HP " .. hp .. " GOLD " .. gold, 3, 1)
|
||||
end
|
||||
|
@ -200,7 +200,7 @@ function ninja:on_collide(e1, e2, dx, dy)
|
||||
|
||||
elseif (e2.type == "obake" or e2.type == "porc") and self.hit == 0 then
|
||||
|
||||
--lutro.audio.play(sfx_hit)
|
||||
lutro.audio.play(sfx_hit)
|
||||
screen_shake = 0.25
|
||||
self.hit = 60
|
||||
if dx > 0 then
|
||||
@ -210,7 +210,7 @@ function ninja:on_collide(e1, e2, dx, dy)
|
||||
end
|
||||
self.y = self.y - 1
|
||||
self.yspeed = -1
|
||||
--self.hp = self.hp - 1
|
||||
hp = hp - 1
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user