|
- -- world module
- local world = require("world")
-
- -- love's load function
- function love.load()
- -- set the overall map offset
- offset = {
- x = 0,
- y = 0
- }
-
- -- generate the world and load the files
- world.new(20, 20)
- world.loadTiles()
- end
-
- -- love's update function
- function love.update(dt)
-
- end
-
- -- love's key press funciton
- function love.keypressed(key, scanCode, isRepeat)
- -- arrow keys for moving offset
- if key == "left" then
- offset.x = offset.x + 16
- end
-
- if key == "right" then
- offset.x = offset.x - 16
- end
-
- if key == "up" then
- offset.y = offset.y + 16
- end
-
- if key == "down" then
- offset.y = offset.y - 16
- end
- end
-
- -- love's draw function
- function love.draw()
- -- clear the window
- love.graphics.clear()
-
- -- draw the map
- world.render(offset)
- end
|