Advertisement
Guest User

Untitled

a guest
Dec 5th, 2023
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. -- main.lua
  2.  
  3. -- require
  4. local inputManager = require("input/inputManager")
  5. local gameStateManager = require("gameStateManager/gameStateManager")
  6. local playScene = require("scenes/playscene")
  7.  
  8. local inputManagerInstance  -- Declare the variable outside any function
  9. local gameStateManagerInstance
  10.  
  11. function love.load()
  12.  
  13.     --input
  14.  
  15.     inputManagerInstance = inputManager:new()
  16.  
  17.     --gamestatemanager
  18.  
  19.     gameStateManagerInstance = gameStateManager:new(inputManagerInstance)
  20.     gameStateManagerInstance:addScene("Playscene", playScene)
  21.     gameStateManagerInstance:load()
  22.  
  23.     --graphics
  24.  
  25.     love.graphics.setDefaultFilter('nearest', 'nearest', 0)
  26. end
  27.  
  28. function love.update(dt)
  29.  
  30.     inputManagerInstance:update(dt)
  31.     gameStateManagerInstance:update(dt)
  32.  
  33. end
  34.  
  35. function love.draw()
  36.  
  37.     gameStateManagerInstance:draw()
  38.    
  39. end
  40.  
  41. --another file playscene.lua
  42.  
  43. function PlayScene:draw()
  44.   love.graphics.push()
  45.   love.graphics.scale(5, 5)
  46.   love.graphics.draw(player.sprite, 0, 0)
  47.   love.graphics.pop()
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement