an unnamed video game
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

49 linhas
876 B

  1. -- world module
  2. local world = require("world")
  3. -- love's load function
  4. function love.load()
  5. -- set the overall map offset
  6. offset = {
  7. x = 0,
  8. y = 0
  9. }
  10. -- generate the world and load the files
  11. world.new(20, 20)
  12. world.loadTiles()
  13. end
  14. -- love's update function
  15. function love.update(dt)
  16. end
  17. -- love's key press funciton
  18. function love.keypressed(key, scanCode, isRepeat)
  19. -- arrow keys for moving offset
  20. if key == "left" then
  21. offset.x = offset.x + 16
  22. end
  23. if key == "right" then
  24. offset.x = offset.x - 16
  25. end
  26. if key == "up" then
  27. offset.y = offset.y + 16
  28. end
  29. if key == "down" then
  30. offset.y = offset.y - 16
  31. end
  32. end
  33. -- love's draw function
  34. function love.draw()
  35. -- clear the window
  36. love.graphics.clear()
  37. -- draw the map
  38. world.render(offset)
  39. end