What aboutTechnoCat wrote:And shouldn't these beinstead ofCode: Select all
function Gamestate.update(self, dt)
Code: Select all
function Gamestate.update(dt)
Code: Select all
function Gamestate:update(dt)
What aboutTechnoCat wrote:And shouldn't these beinstead ofCode: Select all
function Gamestate.update(self, dt)
Code: Select all
function Gamestate.update(dt)
Code: Select all
function Gamestate:update(dt)
Yes, that is much better. What was I thinking?Robin wrote:What about?Code: Select all
function Gamestate:update(dt)
Code: Select all
learnGamestate.update = function(self,dt)
end
Code: Select all
function learnGamestate:update(dt)
end
TechnoCat wrote:I'm trying to use the Interpolater, but it keeps returning a boolean instead of a number.
Code: Select all
table.insert(squares,1,newSquare(function(self,dt)
local valid,alpha = fader(dt)
if valid then self.alpha = alpha end
end))
Yeah, the documentation is ambigious. Gamestate.update(dt) actually calls the update function on the active gamestate. This is for if you don't want to use Gamestate.registerEvents.TechnoCat wrote:And shouldn't these beinstead ofCode: Select all
function Gamestate.update(self, dt)
Code: Select all
function Gamestate.update(dt)
Code: Select all
state = Gamestate.new()
function state:update(dt)
do_stuff()
end
Code: Select all
local GS = require 'hump.gamestate'
menu = GS.new()
Code: Select all
require 'hump.timer'
Code: Select all
Timer = require 'hump.timer'
This is a very welcome change. Thanks vrld!vrld wrote:hump modules are now proper Lua modules.
You can require them to variables, like this:
Code: Select all
state = Gamestate.new()
function state:init()
self.fonts[30] = love.graphics.newFont(30)
self.background = love.graphics.newImage('img/background.jpg')
self.animation = ...
end
Code: Select all
A = class{}
B = class{inherits = A}
C = class{}
D = class{inherits = {B,C}}
Code: Select all
A = class{} -- same as A = class{name = "A"}
print(A) --> 'A'
a = A()
print(a) --> '<instance of A>'
Users browsing this forum: Bing [Bot] and 3 guests