Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Setup
- local loader = require("AdvTiledLoader.Loader")
- loader.path = "maps/"
- map = loader.load("desert.tmx")
- tileLayer = map.layers["Ground"]
- require ("mobs")
- ---------------------------------------------------------------------------------------------------
- -- Fare ad inizio del livello in modo da assicurarsi che boxboy sia nel posto giusto
- Boy.moveTile(0,0)
- Boy.facing = "down"
- ---------------------------------------------------------------------------------------------------
- -- Dichiarato come classe.
- local DesertExample = {}
- ---------------------------------------------------------------------------------------------------
- -- Funzione che verrà richiamata nel main
- function DesertExample.keypressed(k)
- if k == 'w' then Boy.moveTile(0,-1) end
- if k == 'a' then Boy.moveTile(-1,0) end
- if k == 's' then Boy.moveTile(0,1) end
- if k == 'd' then Boy.moveTile(1,0) end
- end
- ---------------------------------------------------------------------------------------------------
- -- Prepara camera e boxboy per il prossimo livello
- function DesertExample.nextLevel()
- global.tX = -5
- global.tY = -434
- Boy.tileX = 8
- Boy.tileY = 22
- Boy.moveTile(0,0)
- Boy.facing = "down"
- displayTime = 0
- end
- ---------------------------------------------------------------------------------------------------
- -- Aggiorna mappa.
- function DesertExample.update(dt)
- end
- ---------------------------------------------------------------------------------------------------
- -- Called from love.draw()
- function DesertExample.draw()
- local ftX, ftY = math.floor(global.tX), math.floor(global.tY)
- love.graphics.translate(ftX, ftY)
- map:draw()
- love.graphics.draw(Boy.image, Boy.quads[Boy.facing], Boy.x, Boy.y)
- love.graphics.print(global.tX,100,100)
- end
- ---------------------------------------------------------------------------------------------------
- return DesertExample
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement