- [NEW] Proves de particles de pols... no me convenç
This commit is contained in:
1 parent
7b63f963b0
commit
a86011ba37
6 files changed
+48
-4
No files matched your search
Binary file not shown.
|
Before Width: | Height: | Size: 826 B After Width: | Height: | Size: 841 B |
@@ -265,4 +265,15 @@ animations = {
|
|||||||
{ frame={x=16,y=0,w=8,h=8}, wait=4 }
|
{ frame={x=16,y=0,w=8,h=8}, wait=4 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
["polseta"] = {
|
||||||
|
cycle = {1,2,3,4,5},
|
||||||
|
loop = false,
|
||||||
|
frames = {
|
||||||
|
{ frame={x=112,y=9,w=4,h=4}, wait=3 },
|
||||||
|
{ frame={x=112,y=13,w=4,h=4}, wait=3 },
|
||||||
|
{ frame={x=116,y=9,w=4,h=4}, wait=3 },
|
||||||
|
{ frame={x=116,y=13,w=4,h=4}, wait=3 },
|
||||||
|
{ frame={x=116,y=13,w=4,h=4}, wait=1 }
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
@@ -58,3 +58,10 @@ function ia.update_gota_esguit(spr)
|
|||||||
spr.pos.x = spr.pos.x + spr.dir.x
|
spr.pos.x = spr.pos.x + spr.dir.x
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ia.update_polseta(spr)
|
||||||
|
if spr.current_frame==5 then sprites.remove(spr) return end
|
||||||
|
|
||||||
|
spr.dir.y = spr.dir.y + 0.1;
|
||||||
|
spr.pos.y = spr.pos.y + spr.dir.y
|
||||||
|
spr.pos.x = spr.pos.x + spr.dir.x
|
||||||
|
end
|
||||||
@@ -109,7 +109,7 @@ function ia.update_hero()
|
|||||||
sprites.hero.jumping = 0
|
sprites.hero.jumping = 0
|
||||||
sprites.hero.jump_throttle = 10
|
sprites.hero.jump_throttle = 10
|
||||||
end
|
end
|
||||||
sprites.hero.jumping = sprites.hero.jumping - 1
|
sprites.hero.jumping = sprites.hero.jumping - 1 --0.47
|
||||||
else
|
else
|
||||||
-- SI NO ESTÀ BOTANT...
|
-- SI NO ESTÀ BOTANT...
|
||||||
-- SI ESTÀ EN UNES ESCALERES...
|
-- SI ESTÀ EN UNES ESCALERES...
|
||||||
@@ -161,16 +161,16 @@ function ia.update_hero()
|
|||||||
-- SI NO ESTÀ CAIGUENT...
|
-- SI NO ESTÀ CAIGUENT...
|
||||||
if tile_under_me1==84 then
|
if tile_under_me1==84 then
|
||||||
map.tile(tx1,ty+2,68)
|
map.tile(tx1,ty+2,68)
|
||||||
local broken_tile = templates.create("brick", {pos={x=tx1<<3, y=(ty+2)<<3}, flipped=sprites.hero.flipped})
|
local broken_tile = templates.create("brick", {pos={x=sprites.tile_to_pixel(tx1), y=sprites.tile_to_pixel(ty+2)}, flipped=sprites.hero.flipped})
|
||||||
table.insert(sprites.list, broken_tile)
|
table.insert(sprites.list, broken_tile)
|
||||||
end
|
end
|
||||||
if tile_under_me2==84 then
|
if tile_under_me2==84 then
|
||||||
map.tile(tx2,ty+2,68)
|
map.tile(tx2,ty+2,68)
|
||||||
local broken_tile = templates.create("brick", {pos={x=tx2<<3, y=(ty+2)<<3}, flipped=sprites.hero.flipped})
|
local broken_tile = templates.create("brick", {pos={x=sprites.tile_to_pixel(tx2), y=sprites.tile_to_pixel(ty+2)}, flipped=sprites.hero.flipped})
|
||||||
table.insert(sprites.list, broken_tile)
|
table.insert(sprites.list, broken_tile)
|
||||||
end
|
end
|
||||||
if tile_under_me1>=16 or tile_under_me1>=16 then
|
if tile_under_me1>=16 or tile_under_me1>=16 then
|
||||||
sprites.hero.pos.y = (ty<<3)-1
|
sprites.hero.pos.y = sprites.tile_to_pixel(ty)-1
|
||||||
end
|
end
|
||||||
anim = "hero_stand"
|
anim = "hero_stand"
|
||||||
if sprites.hero.state == templates.ALIVE then sprites.save_safe_pos() end
|
if sprites.hero.state == templates.ALIVE then sprites.save_safe_pos() end
|
||||||
@@ -188,6 +188,10 @@ function ia.update_hero()
|
|||||||
-- SI POLSA BOTAR...
|
-- SI POLSA BOTAR...
|
||||||
if ( key.down(key.X) or pad.down(pad.A) ) and sprites.hero.jump_throttle == 0 then
|
if ( key.down(key.X) or pad.down(pad.A) ) and sprites.hero.jump_throttle == 0 then
|
||||||
sprites.hero.jumping = 17
|
sprites.hero.jumping = 17
|
||||||
|
table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+6, y=sprites.hero.pos.y+16}, dir={x=-0.7,y=-0.3}, flipped=sprites.hero.flipped}))
|
||||||
|
table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+8, y=sprites.hero.pos.y+15}, dir={x=-0.5,y=-0.1}, flipped=sprites.hero.flipped}))
|
||||||
|
table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+10, y=sprites.hero.pos.y+16}, dir={x=0.7,y=-0.3}, flipped=sprites.hero.flipped}))
|
||||||
|
table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+12, y=sprites.hero.pos.y+15}, dir={x=0.5,y=-0.1}, flipped=sprites.hero.flipped}))
|
||||||
|
|
||||||
-- SI POLSA DISPAR...
|
-- SI POLSA DISPAR...
|
||||||
elseif (sprites.hero.gun_cooldown==0) and (key.down(key.Z) or pad.down(pad.B)) then
|
elseif (sprites.hero.gun_cooldown==0) and (key.down(key.Z) or pad.down(pad.B)) then
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ function sprites.get_tile(num)
|
|||||||
return math.floor(num/8);
|
return math.floor(num/8);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function sprites.tile_to_pixel(num)
|
||||||
|
return math.floor(num)*8;
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function sprites.remove(sprite)
|
function sprites.remove(sprite)
|
||||||
for i,v in ipairs(sprites.list) do
|
for i,v in ipairs(sprites.list) do
|
||||||
if v == sprite then
|
if v == sprite then
|
||||||
|
|||||||
@@ -328,6 +328,23 @@ function me.create(type, options)
|
|||||||
room = options.room,
|
room = options.room,
|
||||||
ia = ia.update_ratpenat
|
ia = ia.update_ratpenat
|
||||||
}
|
}
|
||||||
|
elseif key == "polseta" then
|
||||||
|
sprite = {
|
||||||
|
type = key,
|
||||||
|
pos = options.pos,--{ x=100, y=4*12*8+71 },
|
||||||
|
dir = options.dir,
|
||||||
|
size = { w=4,h=4 },
|
||||||
|
bbo = { left=0, top=0, right=0, bottom=0 },
|
||||||
|
current_frame = 1,
|
||||||
|
current_wait = 1,
|
||||||
|
flipped = options.flipped,
|
||||||
|
surf = surf.load("gfx/morcus.gif"),
|
||||||
|
animation = "polseta",
|
||||||
|
state = me.ALIVE,
|
||||||
|
enemy = true,
|
||||||
|
room = options.room,
|
||||||
|
ia = ia.update_polseta
|
||||||
|
}
|
||||||
else
|
else
|
||||||
error("Template not recognized")
|
error("Template not recognized")
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in new issue
Block a user