- [NEW] Ja es mou entre habitacions
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
game = {
|
||||
chg_adv = {x=0, y=0},
|
||||
chg_step = 0,
|
||||
|
||||
enable = function()
|
||||
app.update = game.update
|
||||
@@ -16,9 +18,37 @@ game = {
|
||||
-- Pintar el mapa i sprites
|
||||
rooms.draw()
|
||||
sprites.update()
|
||||
sprites.update_hero()
|
||||
|
||||
if key.down(key.ESCAPE) then
|
||||
editor.enable()
|
||||
end
|
||||
end,
|
||||
|
||||
change_room = function(x,y)
|
||||
game.chg_adv.x = x
|
||||
game.chg_adv.y = y
|
||||
game.chg_step = 8
|
||||
app.push(game.update_change_room)
|
||||
end,
|
||||
|
||||
update_change_room = function()
|
||||
view.origin(0,0)
|
||||
surf.target(0)
|
||||
view.clip()
|
||||
|
||||
score.draw()
|
||||
|
||||
-- Pintar el mapa i sprites
|
||||
rooms.pos.x = rooms.pos.x + game.chg_adv.x*2.5
|
||||
rooms.pos.y = rooms.pos.y + game.chg_adv.y*1.5
|
||||
sprites.hero.pos.x = sprites.hero.pos.x + game.chg_adv.x
|
||||
sprites.hero.pos.y = sprites.hero.pos.y + game.chg_adv.y
|
||||
rooms.draw()
|
||||
sprites.update()
|
||||
game.chg_step = game.chg_step - 1
|
||||
if game.chg_step == 0 then
|
||||
app.pop()
|
||||
end
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user