- [FIX] Al pulsar la majoria de botons en el menu, fa la acció i tanca el menú automàticament - [FIX] Ajustada la posició d'inici de l'heroi - [FIX] Arreglat bug raro que quan pillaves una moneda algunes momies canviaven de direcció - [WIP] Reajustant els tiles de les habitacions al nou tamany
131 lines
4.5 KiB
Lua
131 lines
4.5 KiB
Lua
templates = {
|
|
ALIVE = 0,
|
|
DYING = 1,
|
|
DEAD = 2,
|
|
RESURRECTING = 3,
|
|
|
|
create = function(type, options)
|
|
local sprite
|
|
local key, value = type:match("^(%S+)%s*(.*)$")
|
|
|
|
if key == "mummy" then
|
|
sprite = {
|
|
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 },
|
|
current_frame = 1,
|
|
current_wait = 1,
|
|
flipped = options.flipped,
|
|
surf = surf.load("mummy.gif"),
|
|
animation = "mummy_walk",
|
|
state = templates.ALIVE,
|
|
enemy = true,
|
|
room = options.room,
|
|
ia = sprites.update_mummy
|
|
}
|
|
elseif key == "bullet" then
|
|
sprite = {
|
|
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 },
|
|
current_frame = 1,
|
|
current_wait = 1,
|
|
flipped = options.flipped,
|
|
surf = surf.load("morcus.gif"),
|
|
animation = "bullet",
|
|
ia = sprites.update_bullet
|
|
}
|
|
elseif key == "coin" then
|
|
sprite = {
|
|
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 },
|
|
current_frame = 1,
|
|
current_wait = 1,
|
|
flipped = options.flipped,
|
|
surf = surf.load("misc.gif"),
|
|
animation = "coin",
|
|
state = templates.ALIVE,
|
|
timer = 0,
|
|
light = 15,
|
|
light_ox = 4,
|
|
light_oy = 4,
|
|
ia = sprites.update_coin
|
|
}
|
|
elseif key == "brick" then
|
|
sprite = {
|
|
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 },
|
|
current_frame = 1,
|
|
current_wait = 1,
|
|
flipped = options.flipped,
|
|
surf = surf.load("misc.gif"),
|
|
animation = "brick",
|
|
state = templates.ALIVE,
|
|
timeout = 10,
|
|
ia = sprites.update_brick
|
|
}
|
|
elseif key == "torxa" then
|
|
sprite = {
|
|
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 },
|
|
current_frame = 1,
|
|
current_wait = 1,
|
|
flipped = options.flipped,
|
|
surf = surf.load("torxa.gif"),
|
|
animation = "torxa",
|
|
state = templates.ALIVE,
|
|
light = 30,
|
|
light_ox = 4,
|
|
light_oy = 4,
|
|
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
|
|
--sprite.room = rooms.current()
|
|
print("creat sprite de tipus "..type)
|
|
return sprite
|
|
end,
|
|
} |