- [NEW] Claus i portes funcionant

This commit is contained in:
2026-03-09 13:46:51 +01:00
parent f2a52570b1
commit 12b322ab6b
15 changed files with 203 additions and 36 deletions

View File

@@ -6,9 +6,11 @@ templates = {
create = function(type, options)
local sprite
if type == "mummy" then
local key, value = type:match("^(%S+)%s*(.*)$")
if key == "mummy" then
sprite = {
type = type,
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=16,h=16 },
bbo = { left=3, top=2, right=3, bottom=0 },
@@ -22,9 +24,9 @@ templates = {
room = options.room,
ia = sprites.update_mummy
}
elseif type == "bullet" then
elseif key == "bullet" then
sprite = {
type = type,
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=4,h=3 },
bbo = { left=0, top=0, right=0, bottom=0 },
@@ -35,9 +37,9 @@ templates = {
animation = "bullet",
ia = sprites.update_bullet
}
elseif type == "coin" then
elseif key == "coin" then
sprite = {
type = type,
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=8,h=8 },
bbo = { left=0, top=0, right=0, bottom=0 },
@@ -52,9 +54,9 @@ templates = {
light_oy = 4,
ia = sprites.update_coin
}
elseif type == "brick" then
elseif key == "brick" then
sprite = {
type = type,
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=8,h=8 },
bbo = { left=0, top=0, right=0, bottom=0 },
@@ -67,9 +69,9 @@ templates = {
timeout = 10,
ia = sprites.update_brick
}
elseif type == "torxa" then
elseif key == "torxa" then
sprite = {
type = type,
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=8,h=16 },
bbo = { left=0, top=0, right=0, bottom=0 },
@@ -85,6 +87,39 @@ templates = {
no_shadow = true,
ia = sprites.update_torxa
}
elseif key == "clau" then
sprite = {
type = key,
color = value,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=16,h=8 },
bbo = { left=0, top=0, right=0, bottom=0 },
current_frame = 1,
current_wait = 1,
flipped = options.flipped,
surf = surf.load(value..".gif"),
animation = "clau",
state = templates.ALIVE,
light = 15,
light_ox = 7,
light_oy = 4,
ia = sprites.update_clau
}
elseif key == "porta" then
sprite = {
type = key,
color = value,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=8,h=16 },
bbo = { left=0, top=0, right=0, bottom=0 },
current_frame = 1,
current_wait = 1,
flipped = options.flipped,
surf = surf.load(value..".gif"),
animation = "porta",
state = templates.ALIVE,
ia = sprites.update_porta
}
else
error("Template not recognized")
end