- [NEW] Alguns ajustos en habitacions
- [FIX] Càlcul del tile més robust
This commit is contained in:
1 parent
af2c8fb68d
commit
7b63f963b0
17 files changed
+38
-32
No files matched your search
+13
-12
@@ -3,7 +3,7 @@ function ia.update_hero()
|
||||
|
||||
if sprites.hero.state == templates.DEAD then
|
||||
if sprites.hero.cooldown > 0 then
|
||||
local tx1, tx2, ty = (sprites.hero.pos.x+4)>>3, (sprites.hero.pos.x+11)>>3, (sprites.hero.pos.y+1)>>3
|
||||
local tx1, tx2, ty = sprites.get_tile(sprites.hero.pos.x+4), sprites.get_tile(sprites.hero.pos.x+11), sprites.get_tile(sprites.hero.pos.y+1)
|
||||
local tile_under_me1 = map.tile(tx1,ty+2)
|
||||
local tile_under_me2 = map.tile(tx2,ty+2)
|
||||
if tile_under_me1 == 0 and tile_under_me2 == 0 then
|
||||
@@ -57,7 +57,7 @@ function ia.update_hero()
|
||||
-- Si li han pegat...
|
||||
if sprites.hero.has_been_hit then
|
||||
if sprites.hero.flipped then
|
||||
local tx, ty = (sprites.hero.pos.x+12)>>3, (sprites.hero.pos.y+16)>>3
|
||||
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
|
||||
game.change_room(1,0)
|
||||
@@ -66,7 +66,7 @@ function ia.update_hero()
|
||||
end
|
||||
end
|
||||
else
|
||||
local tx, ty = (sprites.hero.pos.x+3)>>3, (sprites.hero.pos.y+16)>>3
|
||||
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
|
||||
game.change_room(-1,0)
|
||||
@@ -96,7 +96,7 @@ function ia.update_hero()
|
||||
if sprites.hero.jumping > 0 then
|
||||
anim = "hero_jump"
|
||||
move_anim = "hero_jump"
|
||||
local tx1, tx2, ty = (sprites.hero.pos.x+4)>>3, (sprites.hero.pos.x+11)>>3, (sprites.hero.pos.y)>>3
|
||||
local tx1, tx2, ty = sprites.get_tile(sprites.hero.pos.x+4), sprites.get_tile(sprites.hero.pos.x+11), sprites.get_tile(sprites.hero.pos.y)
|
||||
--draw.rect(tx1<<3,ty<<3,8,8,8)
|
||||
--draw.rect(tx2<<3,ty<<3,8,8,28)
|
||||
if map.tile(tx1,ty) < 16 and map.tile(tx2,ty) < 16 then
|
||||
@@ -113,14 +113,14 @@ function ia.update_hero()
|
||||
else
|
||||
-- SI NO ESTÀ BOTANT...
|
||||
-- SI ESTÀ EN UNES ESCALERES...
|
||||
local txm, ty = (sprites.hero.pos.x+8)>>3, (sprites.hero.pos.y+8)>>3
|
||||
local txm, ty = sprites.get_tile(sprites.hero.pos.x+8), sprites.get_tile(sprites.hero.pos.y+8)
|
||||
if (map.tile(txm,ty) > 0 and map.tile(txm,ty) < 16) or (map.tile(txm,ty+1) > 0 and map.tile(txm,ty+1) < 16) then
|
||||
anim = "hero_stairs_idle"
|
||||
move_anim = "hero_stairs"
|
||||
-- SI PULSA AMUNT...
|
||||
if key.down(key.UP) or pad.down(pad.UP) then
|
||||
anim = move_anim
|
||||
local tx1, tx2, ty = (sprites.hero.pos.x+8)>>3, (sprites.hero.pos.x+11)>>3, (sprites.hero.pos.y)>>3
|
||||
local tx1, tx2, ty = sprites.get_tile(sprites.hero.pos.x+8), sprites.get_tile(sprites.hero.pos.x+11), sprites.get_tile(sprites.hero.pos.y)
|
||||
if map.tile(tx1,ty) < 16 then --or map.tile(tx2,ty) < 16 then
|
||||
if ty+1<rooms.pos.y then
|
||||
game.change_room(0,-1)
|
||||
@@ -131,7 +131,7 @@ function ia.update_hero()
|
||||
-- SI PULSA AVALL...
|
||||
elseif key.down(key.DOWN) or pad.down(pad.DOWN) then
|
||||
anim = move_anim
|
||||
local tx1, tx2, ty = (sprites.hero.pos.x+4)>>3, (sprites.hero.pos.x+11)>>3, (sprites.hero.pos.y+1)>>3
|
||||
local tx1, tx2, ty = sprites.get_tile(sprites.hero.pos.x+4), sprites.get_tile(sprites.hero.pos.x+11), sprites.get_tile(sprites.hero.pos.y+1)
|
||||
if map.tile(tx1,ty+2) < 16 or map.tile(tx2,ty+2) < 16 then
|
||||
if ty+2>rooms.pos.y+12 then
|
||||
game.change_room(0,1)
|
||||
@@ -142,12 +142,13 @@ function ia.update_hero()
|
||||
end
|
||||
else
|
||||
-- SI NO ESTÀ EN UNES ESCALERES...
|
||||
local tx1, txm, tx2, ty = (sprites.hero.pos.x+4)>>3, (sprites.hero.pos.x+8)>>3, (sprites.hero.pos.x+11)>>3, (sprites.hero.pos.y+1)>>3
|
||||
local tx1, txm, tx2, ty = sprites.get_tile(sprites.hero.pos.x+4), sprites.get_tile(sprites.hero.pos.x+8), sprites.get_tile(sprites.hero.pos.x+11), (sprites.hero.pos.y+1)/8
|
||||
-- SI ESTÀ CAIGUENT...
|
||||
local tile_under_me1 = map.tile(tx1,ty+2)
|
||||
local tile_under_me2 = map.tile(tx2,ty+2)
|
||||
if tile_under_me1 == 0 and tile_under_me2 == 0 then
|
||||
if rooms.pos.y<84 and ty+2>rooms.pos.y+12 then
|
||||
|
||||
if rooms.pos.y<84 and sprites.hero.pos.y>=0 and ty+2>rooms.pos.y+12 then
|
||||
game.change_room(0,1)
|
||||
else
|
||||
if sprites.hero.pos.y >= 808 then
|
||||
@@ -177,7 +178,7 @@ function ia.update_hero()
|
||||
if (map.tile(txm,ty+2) < 16 and map.tile(txm,ty+2) > 0) then
|
||||
if key.down(key.DOWN) or pad.down(pad.DOWN) then
|
||||
anim = "hero_stairs"
|
||||
--local tx1, tx2, ty = (sprites.hero.pos.x+4)>>3, (sprites.hero.pos.x+11)>>3, (sprites.hero.pos.y+1)>>3
|
||||
--local tx1, tx2, ty = sprites.get_tile(sprites.hero.pos.x+4), sprites.get_tile(sprites.hero.pos.x+11), sprites.get_tile(sprites.hero.pos.y+1)
|
||||
--if map.tile(tx1,ty+2) < 16 or map.tile(tx2,ty+2) < 16 then
|
||||
sprites.hero.pos.x = (txm << 3)-4
|
||||
sprites.hero.pos.y = sprites.hero.pos.y + 1
|
||||
@@ -204,7 +205,7 @@ function ia.update_hero()
|
||||
if key.down(key.LEFT) or pad.down(pad.LEFT) then
|
||||
sprites.hero.flipped = true
|
||||
anim = move_anim
|
||||
local tx, ty = (sprites.hero.pos.x+3)>>3, (sprites.hero.pos.y+16)>>3
|
||||
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
|
||||
game.change_room(-1,0)
|
||||
@@ -215,7 +216,7 @@ function ia.update_hero()
|
||||
elseif key.down(key.RIGHT) or pad.down(pad.RIGHT) then
|
||||
sprites.hero.flipped = false
|
||||
anim = move_anim
|
||||
local tx, ty = (sprites.hero.pos.x+12)>>3, (sprites.hero.pos.y+16)>>3
|
||||
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
|
||||
game.change_room(1,0)
|
||||
|
||||
Reference in new issue
Block a user