- [NEW] Torxes implementades
@@ -120,4 +120,14 @@ animations = {
|
|||||||
{ frame={x=48,y=0,w=8,h=8}, wait=100 },
|
{ frame={x=48,y=0,w=8,h=8}, wait=100 },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
["torxa"] = {
|
||||||
|
cycle = {1,2,3,4},
|
||||||
|
loop = true,
|
||||||
|
frames = {
|
||||||
|
{ frame={x=0,y=0,w=8,h=16}, wait=2 },
|
||||||
|
{ frame={x=8,y=0,w=8,h=16}, wait=2 },
|
||||||
|
{ frame={x=16,y=0,w=8,h=16}, wait=2 },
|
||||||
|
{ frame={x=24,y=0,w=8,h=16}, wait=2 }
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
@@ -6,5 +6,9 @@ items = {
|
|||||||
[2] = {
|
[2] = {
|
||||||
name="coin",
|
name="coin",
|
||||||
visual = {x=0,y=40,w=8,h=8}
|
visual = {x=0,y=40,w=8,h=8}
|
||||||
|
},
|
||||||
|
[3] = {
|
||||||
|
name="torxa",
|
||||||
|
visual = {x=0,y=48,w=8,h=16}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,6 +53,15 @@ palfade = {
|
|||||||
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
fade_white = function(f)
|
||||||
|
for i=1,32 do
|
||||||
|
local r = math.floor(palfade.reddish[i].r + (255-palfade.reddish[i].r)*f)
|
||||||
|
local g = math.floor(palfade.reddish[i].g + (255-palfade.reddish[i].g)*f)
|
||||||
|
local b = math.floor(palfade.reddish[i].b + (255-palfade.reddish[i].b)*f)
|
||||||
|
pal.color(i-1,r,g,b)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
restore = function()
|
restore = function()
|
||||||
pal.set(palfade.original)
|
pal.set(palfade.original)
|
||||||
end
|
end
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
data/sprites.gif
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -138,7 +138,11 @@ sprites = {
|
|||||||
live = live or sprites.hero.lives-1
|
live = live or sprites.hero.lives-1
|
||||||
local light_table = {[0]=20, 30, 50, 80, 100}
|
local light_table = {[0]=20, 30, 50, 80, 100}
|
||||||
local red_table = {[0]=0, 0.25, 0.5, 0.75, 1}
|
local red_table = {[0]=0, 0.25, 0.5, 0.75, 1}
|
||||||
tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_red(value)end)
|
if live==4 then
|
||||||
|
tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_white(value)end)
|
||||||
|
else
|
||||||
|
tweening.add(1,0,0.25,easing.linear,function(value,n,finished)palfade.fade_red(value)end)
|
||||||
|
end
|
||||||
local start_light = light_table[sprites.hero.lives]
|
local start_light = light_table[sprites.hero.lives]
|
||||||
local start_red = red_table[sprites.hero.lives]
|
local start_red = red_table[sprites.hero.lives]
|
||||||
local end_light = light_table[live]
|
local end_light = light_table[live]
|
||||||
@@ -154,7 +158,7 @@ sprites = {
|
|||||||
sprites.set_animation(sprites.hero, "mummy_dying")
|
sprites.set_animation(sprites.hero, "mummy_dying")
|
||||||
sprites.hero.jumping = 0
|
sprites.hero.jumping = 0
|
||||||
sprites.hero.cooldown = 120
|
sprites.hero.cooldown = 120
|
||||||
else
|
elseif sprites.hero.lives < 4 then
|
||||||
sprites.hero.state = templates.DYING
|
sprites.hero.state = templates.DYING
|
||||||
sprites.hero.cooldown = 60
|
sprites.hero.cooldown = 60
|
||||||
end
|
end
|
||||||
@@ -289,6 +293,25 @@ sprites = {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
update_torxa = function(spr)
|
||||||
|
if spr.state == templates.ALIVE then
|
||||||
|
if sprites.hero.lives == 4 then return end
|
||||||
|
local x1,y1,w1,h1 = util.aabb(spr)
|
||||||
|
local x2,y2,w2,h2 = util.aabb(sprites.hero)
|
||||||
|
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
|
||||||
|
sprites.hit_hero(4)
|
||||||
|
spr.state = templates.DYING
|
||||||
|
spr.timer = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
elseif spr.state == templates.DYING then
|
||||||
|
spr.timer = spr.timer + 1
|
||||||
|
if spr.timer == 32 then
|
||||||
|
spr.state = templates.DYING
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
update_brick = function(spr)
|
update_brick = function(spr)
|
||||||
if spr.timeout > 0 then
|
if spr.timeout > 0 then
|
||||||
spr.timeout = spr.timeout - 1
|
spr.timeout = spr.timeout - 1
|
||||||
@@ -506,13 +529,15 @@ sprites = {
|
|||||||
|
|
||||||
editor.item_hovered = nil
|
editor.item_hovered = nil
|
||||||
local mx,my = mouse.pos()
|
local mx,my = mouse.pos()
|
||||||
if editor.item_selected or editor.layer~=LAYER_ITEMS then ignore_selected = true end
|
if (app.update == editor.update) and (editor.item_selected or editor.layer~=LAYER_ITEMS) then ignore_selected = true end
|
||||||
for i,v in ipairs(sprites.list) do
|
for i,v in ipairs(sprites.list) do
|
||||||
if not ignore_selected and app.update == editor.update and mx>=v.pos.x and mx<=v.pos.x+v.size.w and my>=v.pos.y and my<=v.pos.y+v.size.h then
|
if not ignore_selected and app.update == editor.update and mx>=v.pos.x and mx<=v.pos.x+v.size.w and my>=v.pos.y and my<=v.pos.y+v.size.h then
|
||||||
sprites.draw_sprite_selected(v)
|
sprites.draw_sprite_selected(v)
|
||||||
editor.item_hovered = i
|
editor.item_hovered = i
|
||||||
else
|
else
|
||||||
sprites.draw_sprite(v)
|
if (not ignore_selected) or (not v.no_shadow) or (app.update ~= game.update) then
|
||||||
|
sprites.draw_sprite(v)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sprites.draw_sprite(sprites.hero)
|
sprites.draw_sprite(sprites.hero)
|
||||||
|
|||||||
@@ -67,6 +67,24 @@ templates = {
|
|||||||
timeout = 10,
|
timeout = 10,
|
||||||
ia = sprites.update_brick
|
ia = sprites.update_brick
|
||||||
}
|
}
|
||||||
|
elseif type == "torxa" then
|
||||||
|
sprite = {
|
||||||
|
type = type,
|
||||||
|
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
|
||||||
|
}
|
||||||
else
|
else
|
||||||
error("Template not recognized")
|
error("Template not recognized")
|
||||||
end
|
end
|
||||||
|
|||||||
BIN
data/torxa.gif
Normal file
|
After Width: | Height: | Size: 316 B |