-- The general way of creating an object that implements these functions goes like this:
--[[
MyState=Object:extend()
MyState:implement(State)
functionMyState:init(name)
self:init_state(name)
end
functionMyState:on_enter(from)
end
functionMyState:update(dt)
end
functionMyState:draw()
end
]]--
-- This creates a new MyState class which you can then use to start writing your code.
-- Use the init function for things you need to do when the state object is created.
-- Use the on_enter function for things you need to do whenever the state gets activated.
-- By default, whenever a state gets deactivated it's not deleted from memory, so if you want to restart a level, for instance, whenever you switch states,
-- then you need to destroy everything that needs to be destroyed in an on_exit function and then recreate it again in the on_enter function.