-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
35 lines (29 loc) · 821 Bytes
/
main.lua
File metadata and controls
35 lines (29 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
scenes = {}
scenes.levelselector = require('levelselector')
scenes.menu = require('menu')
scene = scenes.menu
-- Problem: This load function only runs once, therefore if I change my scene its going to just run
-- the update and draw function for that particular state. The load function of any scene will not run
-- except for the menu scene
function changeScene(newScene)
scene_name = newScene
scene = require(newScene) -- Update the current scene
if scene and scene.load then
love.load() -- Call the new scene's load function
end
end
function love.load()
scene.load()
end
function love.keypressed(key)
scene.keypressed(key)
end
function love.mousepressed()
scene.mousepressed()
end
function love.update(dt)
scene.update(dt)
end
function love.draw()
scene.draw()
end