- [NEW] Quan li peguen, Morcus pega un botet cap enrere
- [NEW] Quan peguen a l'heroi, la momia i la rata peguen la volta
This commit is contained in:
@@ -49,6 +49,33 @@ function ia.update_hero()
|
||||
end
|
||||
end
|
||||
|
||||
-- Si li han pegat...
|
||||
if sprites.hero.has_been_hit then
|
||||
if sprites.hero.flipped then
|
||||
local tx, ty = (sprites.hero.pos.x+3)>>3, (sprites.hero.pos.y+16)>>3
|
||||
if map.tile(tx,ty) < 16 and map.tile(tx,ty-1) < 16 then
|
||||
if tx<rooms.pos.x then
|
||||
game.change_room(-1,0)
|
||||
else
|
||||
sprites.hero.pos.x = sprites.hero.pos.x + 1
|
||||
end
|
||||
end
|
||||
else
|
||||
local tx, ty = (sprites.hero.pos.x+12)>>3, (sprites.hero.pos.y+16)>>3
|
||||
if map.tile(tx,ty) < 16 and map.tile(tx,ty-1) < 16 then
|
||||
if tx>rooms.pos.x+19 then
|
||||
game.change_room(1,0)
|
||||
else
|
||||
sprites.hero.pos.x = sprites.hero.pos.x - 1
|
||||
end
|
||||
end
|
||||
end
|
||||
sprites.hero.has_been_hit = sprites.hero.has_been_hit - 1
|
||||
if sprites.hero.has_been_hit == 0 then
|
||||
sprites.hero.has_been_hit = nil;
|
||||
end
|
||||
end
|
||||
|
||||
-- si està en l'animació de disparar, no podem fer res i eixim ja
|
||||
if sprites.hero.shooting then
|
||||
-- A no ser que siga l'ultim frame, en tal cas tornem a estar de peu i au
|
||||
@@ -165,7 +192,7 @@ function ia.update_hero()
|
||||
end
|
||||
end
|
||||
-- ESTIGA COM ESTIGA, SI POLSA ESQUERRA O DRETA...
|
||||
if not sprites.hero.shooting then
|
||||
if not sprites.hero.shooting and not sprites.hero.has_been_hit then
|
||||
if key.down(key.LEFT) or pad.down(pad.LEFT) then
|
||||
sprites.hero.flipped = true
|
||||
anim = move_anim
|
||||
@@ -221,6 +248,10 @@ function ia.hero_hit(live)
|
||||
elseif sprites.hero.lives < 4 then
|
||||
sprites.hero.state = templates.DYING
|
||||
sprites.hero.cooldown = 60
|
||||
sprites.hero.shooting = false
|
||||
sprites.set_animation(sprites.hero, "hero_stand")
|
||||
sprites.hero.jumping = 8
|
||||
sprites.hero.has_been_hit = 16
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user