- [NEW] Afegit cooldown entre dispar i dispar

- [NEW] mòdul console
- [NEW] mòdul tweening
- [NEW] mòdul palfade
This commit is contained in:
2026-02-24 18:59:28 +01:00
parent 12673f1dc4
commit 7ba7fc04d6
6 changed files with 506 additions and 4 deletions

View File

@@ -61,6 +61,7 @@ sprites = {
light = 100,
light_ox = 0,
light_oy = 0,
cooldown = 0,
stairs = false
}
--table.insert(sprites.list, templates.create("mummy", {pos={x=100, y=4*12*8+71},flipped=true}))
@@ -200,7 +201,7 @@ sprites = {
local tx, ty = (spr.pos.x)>>3, (spr.pos.y)>>3
map.surf(rooms.surf_items)
map.tile(tx,ty,0)
spr.state = templates.DYING
sprites.set_animation(spr, "coin_picked")
spr.pos.y=spr.pos.y-16
@@ -227,6 +228,10 @@ sprites = {
local anim = "hero_stand"
local move_anim = "hero_walk"
if sprites.hero.cooldown > 0 then
sprites.hero.cooldown = sprites.hero.cooldown - 1
end
if sprites.hero.shooting then
if sprites.hero.current_frame==3 then
sprites.hero.shooting = false
@@ -315,8 +320,9 @@ sprites = {
sprites.hero.jumping = 17
-- SI POLSA DISPAR...
elseif key.down(key.X) or pad.down(pad.B) then
elseif (sprites.hero.cooldown==0) and (key.down(key.X) or pad.down(pad.B)) then
sprites.hero.shooting = true
sprites.hero.cooldown = 20
local x = sprites.hero.flipped and sprites.hero.pos.x+8 or sprites.hero.pos.x-8
local bullet = templates.create("bullet", {pos={x=sprites.hero.pos.x, y=sprites.hero.pos.y+7}, flipped=sprites.hero.flipped})
table.insert(sprites.list, bullet)