tween.lua
- KingRecycle
- Prole
- Posts: 44
- Joined: Thu May 24, 2012 1:01 am
Re: tween.lua
It seems for me the callback is being called right away and not when the tween is finished.
- KingRecycle
- Prole
- Posts: 44
- Joined: Thu May 24, 2012 1:01 am
Re: tween.lua
Oh...so that is how you do it. Whoops. Thanks.
- mangadrive
- Prole
- Posts: 32
- Joined: Sat Nov 17, 2012 10:26 pm
Re: tween.lua
I've been messing with this for the past 30 mins and I cannot get anything to draw. I'm fairly certain I have it hooked up right, but even the basic demo examples won't work.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: tween.lua
Hello there.mangadrive wrote:I've been messing with this for the past 30 mins and I cannot get anything to draw. I'm fairly certain I have it hooked up right, but even the basic demo examples won't work.
I'd like to help you, but I'm afraid your message is too vage. By reading this, all I can tell you is "Sorry, you must be doing something wrong in your code".
In order to give you a more helpful answer, I'd need more. Something that helps me see the problem. Reading the code that you wrote would almost certainly help. The whole .love file, even if it draws nothing, would be even better.
When I write def I mean function.
- mangadrive
- Prole
- Posts: 32
- Joined: Sat Nov 17, 2012 10:26 pm
Re: tween.lua
I'm using your coded examples from your git. Maybe not correctly but it's your code.
Using require tween with local gives a nil value.. If I remove local it runs, and when you call the console it prints, but I see no tweens. I've required "tween" as in pointing to the lua file itself. I've set the background different colors, I've run with and without bat. I've put the globals in load, i've put them in draw. I've divided the code up every which way.. Your "traffic light" example on the git doesn't work either due to syntax. I'm still kind of new to Love 2d and LUA. I respect that you aren't entitled to teach people these things to use your library, but either I translated the information poorly (more likely) or there wasn't enough.
I hope that didn't sound disrespectful. Just meaning I didn't know how to use the code or examples you provide without getting erroneous results.
Code: Select all
function love.load()
local tween = require 'tween'
end
function love.draw()
local backgroundColor = {255,255,255}
tween(2, backgroundColor, {0,0,0}, 'linear', print, "hello!")
local label = { x=200, y=0, text = "hello" }
tween(4, label, { y=300 }, 'outBounce')
end
function love.update(dt)
tween.update(dt)
end
I hope that didn't sound disrespectful. Just meaning I didn't know how to use the code or examples you provide without getting erroneous results.
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: tween.lua
Oh, I see.
In general (like 95% of the time), require statements are at the beginning of each file, and outside all functions.
Try putting the `local tween = require 'tween'` line outside of love.load:
In general (like 95% of the time), require statements are at the beginning of each file, and outside all functions.
Try putting the `local tween = require 'tween'` line outside of love.load:
Code: Select all
local tween = require 'tween'
function love.load()
-- whatever else you want to put here
end
function love.draw()
-- same as before
end
When I write def I mean function.
- mangadrive
- Prole
- Posts: 32
- Joined: Sat Nov 17, 2012 10:26 pm
Re: tween.lua
I guess I'm missing something very valuable here or my super_noob status is level 9k+
Still just a black screen with "test". No tweens.
Code: Select all
local tween = require 'tween'
function love.draw()
love.graphics.setColor(255,255,255,255)
love.graphics.print("test",0,0)
local label = { x=200, y=0, text = "hello" }
tween(4, label, { y=300 }, 'outBounce')
end
function love.update(dt)
tween.update(dt)
end
Who is online
Users browsing this forum: No registered users and 2 guests