Code: Select all
function player.move(form,dt)
if form=='A' then formA.move(dt)
else formB.move(dt)
end
end
function love.update(dt)
...
player.move(player.form,dt)
...
end
Code: Select all
function player.move(form,dt)
if form=='A' then formA.move(dt)
else formB.move(dt)
end
end
function love.update(dt)
...
player.move(player.form,dt)
...
end
Code: Select all
function test.changeOption()
local o=menu.option
if o==1 then function test.draw() testA.draw() end
elseif o==2 then function test.draw() testB.draw() end
end
end
Code: Select all
local var = ... -- a numeric value in this specific case
local tests = {}
tests[1] = function (...) -- blah --blah end
tests[2] = function (...) -- blah --blah end
...
tests[n] = function (...) -- blah --blah end
callback body {
if tests[var] then tests[var](...) end
}
Users browsing this forum: Bing [Bot] and 5 guests