- [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:
1 parent
1f6fd47b6d
commit
d2ebbccbf6
20 files changed
+172
-27
No files matched your search
@@ -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
|
||||
|
||||
|
||||
@@ -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}))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
function ia.do_nothing(spr)
|
||||
-- este actor no fa res
|
||||
end
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user