diff --git a/index.html b/index.html index d766764..fa0ff6f 100644 --- a/index.html +++ b/index.html @@ -133,6 +133,8 @@
A gamestate can define (nearly) all callbacks that LÖVE defines. In addition, there are callbacks for entering and leaving a state.:
menu = Gamestate.new()
-function menu:enter(previous, background_image)
- self.background = background_image
+function menu:init() -- run only once
+ self.background = love.graphics.newImage('bg.jpg')
Buttons.initialize()
end
-function menu:leave()
- Buttons.cleanup()
+function menu:enter(previous) -- run every time the state is entered
+ Buttons.setActive(Buttons.start)
end
function menu:update(dt)
@@ -228,8 +230,9 @@ end
Switch to a gamestate, with any additional arguments passed to the new state.
Switching a gamestate will call the leave()
callback on
- the current gamestate, replace the current gamestate with to
and finally call
- enter(old_state, ...)
on the new gamestate.
to
, call the
+ init()
function if the state was not yet inialized and
+ finally call enter(old_state, ...)
on the new gamestate.
to