- [NEW] El mono

- [NEW] Noves animacions de detallets
- [NEW] Més particles i eye candy
- [FIX] Si es ficava un item/enemic en la fila de baix del tot no es guardaba
- [FIX] Quan se disaparaba cap a la dreta amb el final de la pantalla o una pared en la esquena, la bala no eixia
- [WIP] Treballant en el marcador
This commit is contained in:
Raimon @ quifisraimon committed 2026-10-06 15:56:37 +02:00
1 parent 1f6fd47b6d
commit d2ebbccbf6
20 files changed
+171 -26

No files matched your search

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 841 B

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+20 -3
View File
@@ -1,10 +1,11 @@
animations = {
["hero_stand"] = {
cycle = {1},
loop = false,
cycle = {1,2},
loop = true,
frames = {
{ frame={x=0,y=0,w=16,h=17}, wait=4 },
{ frame={x=0,y=0,w=16,h=17}, wait=100 },
{ frame={x=120,y=0,w=16,h=17}, wait=4 },
}
},
["hero_jump"] = {
@@ -276,4 +277,20 @@ animations = {
{ frame={x=116,y=13,w=4,h=4}, wait=1 }
}
},
["mono_wait"] = {
cycle = {1,1,2,1,2,1,1,2,1,3},
loop = true,
frames = {
{ frame={x=0 ,y=0,w=16,h=16}, wait=40 },
{ frame={x=16,y=0,w=16,h=16}, wait=4 },
{ frame={x=32,y=0,w=16,h=16}, wait=80 }
}
},
["invisible"] = {
cycle = {1},
loop = false,
frames = {
{ frame={x=89 ,y=48,w=7,h=7}, wait=1 }
}
},
}
+3
View File
@@ -9,6 +9,7 @@ function ia.update_berserk(spr)
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
sprites.hero.hit()
spr.flipped = not spr.flipped
sprites.dust(spr)
end
end
@@ -20,6 +21,7 @@ function ia.update_berserk(spr)
spr.pos.x = spr.pos.x - advance
else
spr.flipped = not spr.flipped
sprites.dust(spr)
end
else
local tx, ty = sprites.get_tile(spr.pos.x+12), sprites.get_tile(spr.pos.y+15)
@@ -27,6 +29,7 @@ function ia.update_berserk(spr)
spr.pos.x = spr.pos.x + advance
else
spr.flipped = not spr.flipped
sprites.dust(spr)
end
end
+6
View File
@@ -16,6 +16,9 @@ function ia.update_bullet(spr)
v.state = templates.DYING
end
end
local dir = 0.1
if spr.flipped then dir = -dir end
sprites.dust_ex(spr, {pos={x=spr.pos.x, y=spr.pos.y}, dir={x=-0.1,y=-1.2}, flipped=not spr.flipped})
sprites.remove(spr)
return
end
@@ -35,6 +38,9 @@ function ia.update_bullet(spr)
end
function bullet_ricochet(spr)
local dir = 0.1
if spr.flipped then dir = -dir end
sprites.dust_ex(spr, {pos={x=spr.pos.x, y=spr.pos.y}, dir={x=-0.1,y=-1.2}, flipped=not spr.flipped})
sprites.remove(spr)
table.insert(sprites.list, templates.create("bullet_particle", {pos={x=spr.pos.x, y=spr.pos.y}, dir={x= 1,y= math.random(3,5)}, flipped=spr.flipped}))
table.insert(sprites.list, templates.create("bullet_particle", {pos={x=spr.pos.x, y=spr.pos.y}, dir={x=-1,y= math.random(3,5)}, flipped=spr.flipped}))
+3
View File
@@ -9,6 +9,7 @@ function ia.update_dimoni(spr)
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
sprites.hero.hit()
spr.flipped = not spr.flipped
sprites.dust(spr)
end
end
@@ -18,6 +19,7 @@ function ia.update_dimoni(spr)
spr.pos.x = spr.pos.x - 1
else
spr.flipped = not spr.flipped
sprites.dust(spr)
end
else
local tx, ty = sprites.get_tile(spr.pos.x+12), sprites.get_tile(spr.pos.y+15)
@@ -25,6 +27,7 @@ function ia.update_dimoni(spr)
spr.pos.x = spr.pos.x + 1
else
spr.flipped = not spr.flipped
sprites.dust(spr)
end
end
end
+3
View File
@@ -19,6 +19,9 @@ function ia.update_gota(spr)
end
function gota_esguita(spr)
local dir = 0.1
if spr.flipped then dir = -dir end
sprites.dust_ex(spr, {pos={x=spr.pos.x, y=spr.pos.y}, dir={x=-0.1,y=-1.2}, flipped=not spr.flipped})
sprites.remove(spr)
table.insert(sprites.list, templates.create("gota_esguit", {pos={x=spr.pos.x, y=spr.pos.y}, dir={x= 1,y= math.random(3,5)}, flipped=spr.flipped}))
table.insert(sprites.list, templates.create("gota_esguit", {pos={x=spr.pos.x, y=spr.pos.y}, dir={x=-1,y= math.random(3,5)}, flipped=spr.flipped}))
+33 -6
View File
@@ -92,6 +92,10 @@ function ia.update_hero()
end
end
local on_the_floor = false
local was_falling = sprites.hero.falling
sprites.hero.falling = false
-- SI ESTÀ BOTANT...
if sprites.hero.jumping > 0 then
anim = "hero_jump"
@@ -156,9 +160,11 @@ function ia.update_hero()
return
end
sprites.hero.pos.y = sprites.hero.pos.y + 2
sprites.hero.falling = true
end
else
-- SI NO ESTÀ CAIGUENT...
on_the_floor = true
if tile_under_me1==84 then
map.tile(tx1,ty+2,68)
local broken_tile = templates.create("brick", {pos={x=sprites.tile_to_pixel(tx1), y=sprites.tile_to_pixel(ty+2)}, flipped=sprites.hero.flipped})
@@ -169,7 +175,7 @@ function ia.update_hero()
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)
end
if tile_under_me1>=16 or tile_under_me1>=16 then
if tile_under_me1>=16 or tile_under_me2>=16 then
sprites.hero.pos.y = sprites.tile_to_pixel(ty)-1
end
anim = "hero_stand"
@@ -188,16 +194,19 @@ function ia.update_hero()
-- SI POLSA BOTAR...
if ( key.down(key.X) or pad.down(pad.A) ) and sprites.hero.jump_throttle == 0 then
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}))
sprites.dust(sprites.hero)
---table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+6, y=sprites.hero.pos.y+16}, dir={x=-0.9,y=-0.5}, flipped=sprites.hero.flipped}))
---table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+8, y=sprites.hero.pos.y+17}, dir={x=-0.5,y=-0.7}, 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.9,y=-0.5}, flipped=sprites.hero.flipped}))
---table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+12, y=sprites.hero.pos.y+17}, dir={x=0.5,y=-0.7}, flipped=sprites.hero.flipped}))
-- SI POLSA DISPAR...
elseif (sprites.hero.gun_cooldown==0) and (key.down(key.Z) or pad.down(pad.B)) then
sprites.hero.shooting = true
sprites.hero.gun_cooldown = 20
local bullet = templates.create("bullet", {pos={x=sprites.hero.pos.x, y=sprites.hero.pos.y+7}, flipped=sprites.hero.flipped})
local start_x = sprites.hero.pos.x
if not sprites.hero.flipped then start_x = start_x + 16 end
local bullet = templates.create("bullet", {pos={x=start_x, y=sprites.hero.pos.y+7}, flipped=sprites.hero.flipped})
table.insert(sprites.list, bullet)
anim = "hero_shoot"
end
@@ -206,9 +215,15 @@ function ia.update_hero()
end
-- ESTIGA COM ESTIGA, SI POLSA ESQUERRA O DRETA...
if not sprites.hero.shooting and not sprites.hero.has_been_hit then
local was_flipped = sprites.hero.flipped
local was_standing = sprites.hero.animation == "hero_stand"
if key.down(key.LEFT) or pad.down(pad.LEFT) then
sprites.hero.flipped = true
if on_the_floor and (was_standing or not was_flipped) then sprites.dust(sprites.hero) end
anim = move_anim
--if on_the_floor and sprites.hero.current_wait == 1 and (sprites.hero.current_frame == 1 or sprites.hero.current_frame == 3) then
-- table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+10, y=sprites.hero.pos.y+16}, dir={x=0.1,y=-0.7}, flipped=sprites.hero.flipped}))
--end
local tx, ty = sprites.get_tile(sprites.hero.pos.x+3), sprites.get_tile(sprites.hero.pos.y+16)
if map.tile(tx,ty) < 16 and map.tile(tx,ty-1) < 16 then
if tx<rooms.pos.x then
@@ -219,7 +234,11 @@ function ia.update_hero()
end
elseif key.down(key.RIGHT) or pad.down(pad.RIGHT) then
sprites.hero.flipped = false
if on_the_floor and (was_standing or was_flipped) then sprites.dust(sprites.hero) end
anim = move_anim
--if on_the_floor and sprites.hero.current_wait == 1 and (sprites.hero.current_frame == 1 or sprites.hero.current_frame == 3) then
-- table.insert(sprites.list, templates.create("polseta", {pos={x=sprites.hero.pos.x+4, y=sprites.hero.pos.y+16}, dir={x=-0.1,y=-0.7}, flipped=sprites.hero.flipped}))
--end
local tx, ty = sprites.get_tile(sprites.hero.pos.x+12), sprites.get_tile(sprites.hero.pos.y+16)
if map.tile(tx,ty) < 16 and map.tile(tx,ty-1) < 16 then
if tx>rooms.pos.x+19 then
@@ -230,6 +249,14 @@ function ia.update_hero()
end
end
end
if (was_falling and not sprites.hero.falling) then
sprites.hero.flipped = not sprites.hero.flipped
sprites.dust(sprites.hero)
sprites.hero.flipped = not sprites.hero.flipped
sprites.dust(sprites.hero)
end
sprites.set_animation(sprites.hero, anim)
end
+3
View File
@@ -9,6 +9,7 @@ function ia.update_mummy(spr)
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
sprites.hero.hit()
spr.flipped = not spr.flipped
sprites.dust(spr)
end
end
@@ -18,6 +19,7 @@ function ia.update_mummy(spr)
spr.pos.x = spr.pos.x - 1
else
spr.flipped = not spr.flipped
sprites.dust(spr)
end
else
local tx, ty = sprites.get_tile(spr.pos.x+12), sprites.get_tile(spr.pos.y+15)
@@ -25,6 +27,7 @@ function ia.update_mummy(spr)
spr.pos.x = spr.pos.x + 1
else
spr.flipped = not spr.flipped
sprites.dust(spr)
end
end
elseif spr.state == templates.DYING then
+4
View File
@@ -0,0 +1,4 @@
function ia.do_nothing(spr)
-- este actor no fa res
end
+6
View File
@@ -8,9 +8,15 @@ function ia.update_porta(spr)
sprites.hero.keys[spr.color] = nil
sprites.set_animation(spr, "porta_obrint")
spr.state = templates.DYING
spr.last_frame=0
end
end
elseif spr.state == templates.DYING then
if spr.current_frame ~= spr.last_frame then
spr.last_frame = spr.current_frame
sprites.dust_ex(spr, {pos={x=spr.pos.x+1, y=spr.pos.y+16-spr.last_frame}, dir={x=math.random()-0.5,y=0.9}, flipped=spr.flipped})
end
if spr.current_frame == 15 then
local tx, ty = sprites.get_tile(spr.pos.x), sprites.get_tile(spr.pos.y)
map.surf(rooms.surf_items)
+2
View File
@@ -21,4 +21,6 @@ items = {
{ name="abad", label="abad", visual={x=16, y=0, w=16, h=16} },
{ name="dimoni", label="dimoni", visual={x=32, y=0, w=16, h=17} },
{ name="ratpenat", label="ratpenat", visual={x=16, y=64, w=8, h=8} },
{ name="mono", label="mono", visual={x=0, y=80, w=16, h=16} },
{ name="llum", label="llum", visual={x=89, y=48, w=7, h=7} },
}
+25 -16
View File
@@ -1,6 +1,6 @@
score = {
points = 0,
color = 28,
color = 27,
ypos = 3,
surf = nil,
font = nil
@@ -14,21 +14,24 @@ function me.init(reinit)
end
local function draw_text()
font.current(me.font)
font.spacing(0)
local txt = string.format("%03d", me.points)
-- draw.text(txt,2,me.ypos-1,27)
-- draw.text(txt,3,me.ypos-1,27)
-- draw.text(txt,4,me.ypos-1,27)
-- draw.text(txt,2,me.ypos,27)
-- draw.text(txt,4,me.ypos,27)
-- draw.text(txt,2,me.ypos+1,27)
-- draw.text(txt,4,me.ypos+1,27)
-- draw.text(txt,2,me.ypos+2,27)
-- draw.text(txt,3,me.ypos+2,27)
-- draw.text(txt,4,me.ypos+2,27)
draw.text(txt,3,me.ypos+1,1)
draw.text(txt,3,me.ypos,me.color)
draw.text(txt,10,me.ypos,me.color)
-- font.current(me.font)
-- font.spacing(0)
-- draw.text(txt,2,me.ypos+2,1)
-- draw.text(txt,3,me.ypos+2,1)
-- draw.text(txt,4,me.ypos+2,1)
-- draw.text(txt,2,me.ypos-1,26)
-- draw.text(txt,3,me.ypos-1,26)
-- draw.text(txt,4,me.ypos-1,26)
-- draw.text(txt,2,me.ypos,26)
-- draw.text(txt,4,me.ypos,26)
-- draw.text(txt,2,me.ypos+1,26)
-- draw.text(txt,4,me.ypos+1,26)
---- draw.text(txt,3,me.ypos+1,1)
-- draw.text(txt,3,me.ypos,me.color)
font.current(font.DEFAULT)
font.spacing(1)
surf.source(me.surf)
@@ -46,6 +49,9 @@ local function draw_key(sx,sy,dx,dy)
end
function me.draw()
local paleta = palfade.get()
palfade.restore()
if sprites.hero.state == templates.DEAD then
if me.ypos > -100 then me.ypos=me.ypos-1 end
end
@@ -54,16 +60,19 @@ function me.draw()
surf.clip()
draw_text()
draw.surf(0,40,8,8, 1,1)
local y = score.ypos
if sprites.hero.keys["verda"] then draw_key(16,48,140,y) y=y+8 end
if sprites.hero.keys["groga"] then draw_key(16,56,140,y) y=y+8 end
if sprites.hero.keys["roja"] then draw_key(32,48,140,y) y=y+8 end
if sprites.hero.keys["blava"] then draw_key(32,56,140,y) y=y+8 end
palfade.set(paleta)
end
function me.inc(value)
me.points = me.points + value
tweening.add(8, 0, 0.5, easing.linear, function(val,progress,finished) me.color = (math.floor(val)&1) == 0 and 28 or 14 end)
tweening.add(8, 0, 0.5, easing.linear, function(val,progress,finished) me.color = (math.floor(val)&1) == 0 and 27 or 14 end)
tweening.add(5, 3, 0.5, easing.easeOutElastic, function(val,progress,finished) me.ypos = math.floor(val) end)
end
+13 -1
View File
@@ -43,7 +43,7 @@ end
function sprites.add_from_room(rx,ry)
sprites.list = {}
map.surf(rooms.surf_items)
for y = ry, ry+11 do
for y = ry, ry+12 do
for x = rx, rx+19 do
if map.tile(x,y) ~= 0 then
local room = (rx//20) + (ry//12) * 8
@@ -260,3 +260,15 @@ function sprites.draw_sprite_selected(sprite)
draw.mode(draw.NORMAL)
draw.surf(sx, sy, w, h, x, y, w, h, f)
end
function sprites.dust(spr)
if spr.flipped then
table.insert(sprites.list, templates.create("polseta", {pos={x=spr.pos.x+10, y=spr.pos.y+16}, dir={x=-0.1,y=-0.7}, flipped=not spr.flipped}))
else
table.insert(sprites.list, templates.create("polseta", {pos={x=spr.pos.x+4, y=spr.pos.y+16}, dir={x=-0.1,y=-0.7}, flipped=not spr.flipped}))
end
end
function sprites.dust_ex(spr, options)
table.insert(sprites.list, templates.create("polseta", options))
end
+37
View File
@@ -345,6 +345,43 @@ function me.create(type, options)
room = options.room,
ia = ia.update_polseta
}
elseif key == "mono" then
sprite = {
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=16,h=16 },
bbo = { left=0, top=0, right=0, bottom=0 },
current_frame = 1,
current_wait = 1,
flipped = options.flipped,
surf = surf.load("gfx/mono.gif"),
animation = "mono_wait",
state = me.ALIVE,
enemy = true,
bulletproof = true,
room = options.room,
ia = ia.do_nothing
}
elseif key == "llum" then
sprite = {
type = key,
pos = options.pos,--{ x=100, y=4*12*8+71 },
size = { w=7,h=7 },
bbo = { left=0, top=0, right=0, bottom=0 },
current_frame = 1,
current_wait = 1,
flipped = options.flipped,
surf = surf.load("gfx/sprites.gif"),
animation = "invisible",
state = me.ALIVE,
enemy = true,
bulletproof = true,
room = options.room,
light = 40,
light_ox = 4,
light_oy = 4,
ia = ia.do_nothing
}
else
error("Template not recognized")
end
+13
View File
@@ -59,3 +59,16 @@ end
function me.restore()
pal.set(me.original)
end
function me.get()
paleta = {}
for i=1,32 do
paleta[i] = {}
paleta[i].r, paleta[i].g, paleta[i].b = pal.color(i-1)
end
return paleta
end
function me.set(paleta)
pal.set(paleta)
end