- [FIX] arreglos en alguna habitació

- [NEW] particles quan la bala rebota
This commit is contained in:
2026-04-14 21:46:05 +02:00
parent 59fb6faa95
commit 3ca9f28021
6 changed files with 34 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ function ia.update_bullet(spr)
if util.check_aabb_collision(x1,y1,w1,h1, x2,y2,w2,h2) then
if v.state == templates.ALIVE then
if v.bulletproof then
gota_esguita(spr)
bullet_ricochet(spr)
else
v.state = templates.DYING
end
@@ -29,7 +29,15 @@ function ia.update_bullet(spr)
spr.pos.x = spr.pos.x + 8
end
else
sprites.remove(spr)
bullet_ricochet(spr)
--sprites.remove(spr)
end
end
function bullet_ricochet(spr)
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}))
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}))
end