- [NEW] Agafar monedes augmenta el marcador - [NEW] Marcador bàsic visible - [NEW] Al cambiar d'habitació es manté el efecte d'iluminació. A més, va un poc més lento - [NEW] Al agafar moneda, no torna al eixir i entrar. Al tornar al editor se recupera. - [NEW] Gestió de l'iluminació fora dels update i dins dels draw - [NEW] Afegides més habitacions
62 lines
2.0 KiB
Lua
62 lines
2.0 KiB
Lua
templates = {
|
|
ALIVE = 0,
|
|
DYING = 1,
|
|
DEAD = 2,
|
|
RESURRECTING = 3,
|
|
|
|
create = function(type, options)
|
|
local sprite
|
|
if type == "mummy" then
|
|
sprite = {
|
|
type = type,
|
|
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 type == "bullet" then
|
|
sprite = {
|
|
type = type,
|
|
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 type == "coin" then
|
|
sprite = {
|
|
type = type,
|
|
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,
|
|
light = 15,
|
|
light_ox = 4,
|
|
light_oy = 4,
|
|
ia = sprites.update_coin
|
|
}
|
|
else
|
|
error("Template not recognized")
|
|
end
|
|
--sprite.room = rooms.current()
|
|
print("creat sprite de tipus "..type)
|
|
return sprite
|
|
end,
|
|
} |