Page 1 of 1
love.draw error?
Posted: Fri Jan 08, 2016 9:30 pm
by larz
Code: Select all
local run={};
do
run.draw=love.draw;
function run.draw()
love.graphics.print("Hello.",100,100);
end
end
Why this doesn't works?
Re: love.draw error?
Posted: Fri Jan 08, 2016 9:39 pm
by Ref
Code: Select all
function love.draw()
love.graphics.print('Hello!',100,100)
end
Re: love.draw error?
Posted: Fri Jan 08, 2016 10:03 pm
by larz
Can't i reffer to it by run.draw?
Re: love.draw error?
Posted: Fri Jan 08, 2016 10:38 pm
by larz
Someone?
Re: love.draw error?
Posted: Fri Jan 08, 2016 10:55 pm
by veethree
Is there a reason why you don't want to just use love.draw?
I
think if you want to call it run.draw you would have to use a custom
love.run function.
Re: love.draw error?
Posted: Fri Jan 08, 2016 10:58 pm
by slime
Code: Select all
local run = {}
function run.draw()
love.graphics.print("hi")
end
love.draw = run.draw
(Not that it's particularly useful to do something like that...)
Re: love.draw error?
Posted: Fri Jan 08, 2016 11:35 pm
by Ref
But that doesn't print to the screen (at 100,100) but prints 'Hi 100 100".
Re: love.draw error?
Posted: Sat Jan 09, 2016 9:06 pm
by Jasoco
You're overthinking it. Use this as a starting point:
Code: Select all
function love.load()
--Put stuff here that needs to be loaded once like creating images or fonts
end
function love.update(dt)
--Update things here using dt as a delta (Amount per second)
end
function love.draw()
love.graphics.print("Hello.", 100, 100)
end
While you can put functions in other functions, it won't do anything unless you actually call it.
And look at the Wiki.
Re: love.draw error?
Posted: Sun Jul 23, 2017 12:01 pm
by PGUp
Why do you need to make it very complex..