News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
animations in murgalua
Author Message
widged
Junior Member
**


Posts: 35
Group: Registered
Joined: May 2007
Status: Offline
Reputation: 0
Post: #1
animations in murgalua

Having a go at this. Read the Lua 5.0 manual.. nice language! Problem is this is my first lua program. What I tried to do was rewrite a nice little script to move a sprite along a bezier line I wrote with another language.



As I don't know how to make a drag and drop, I use dials to specify the position of the two orange points that makes the extremities of a bezier curve and two green points to define the position of the control handles. This part works nicely.

What I can't figure out how to manage is the animation business. I defined the part of the script that will move the sprite as a coroutine and I resume that coroutine when the user press on the play button. This works when I force an onscreen event to occur (having a message box display a message). This doesn't work anymore when I remove it.

That's the relevant part of script:

Code:
function animate_callback(object)
      starttime = os.time()
      repeat
        curtime = os.time()
        delay = curtime - starttime
        if delay >= 1 then
          coroutine.resume(anim)
          fltk.fl_message(delay) --> doesn't work if I remove this
          window:redraw();
          starttime = curtime
        end
      until coroutine.status(anim) == "dead"
      -- io.output("bezier_points.txt")
      -- io.write(serialize(points))
    end


The full script is available at: animation script
(as the script refers to lib files and pictures with a path relative to the anim.lua script, it needs to be run from within the folder itself)

Is this a Lua issue?

This post was last modified: 05-28-2007 10:07 AM by widged.

05-28-2007 09:16 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
animations in murgalua - widged - 05-28-2007 09:16 AM
RE: animations in murgalua - widged - 05-28-2007, 10:28 AM
RE: animations in murgalua - widged - 05-28-2007, 10:36 AM
RE: animations in murgalua - iGame3D - 05-28-2007, 12:31 PM
RE: animations in murgalua - chrimo - 05-29-2007, 08:10 AM
RE: animations in murgalua - mikshaw - 05-29-2007, 09:52 PM
RE: animations in murgalua - iGame3D - 05-30-2007, 12:08 AM
RE: animations in murgalua - mikshaw - 06-23-2007, 05:57 PM
RE: animations in murgalua - iGame3D - 06-25-2007, 10:36 AM
RE: animations in murgalua - mikshaw - 06-25-2007, 11:31 AM
RE: animations in murgalua - JohnMurga - 06-27-2007, 10:01 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: