![]() |
animations in murgalua - Printable Version +- Murga-Projects Forums (http://www.murga-projects.com/forum) +-- Forum: Project Forums (/forumdisplay.php?fid=1) +--- Forum: MurgaLua - General (/forumdisplay.php?fid=2) +--- Thread: animations in murgalua (/showthread.php?tid=28) |
animations in murgalua - widged - 05-28-2007 09:16 AM 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)
RE: animations in murgalua - widged - 05-28-2007 10:28 AM Bill (igame3D) provided the solution: Code: function animate_callback(object)
RE: animations in murgalua - widged - 05-28-2007 10:36 AM Okay, I don't need the coroutine business anymore. I only need a call Code: run_anim(sprite,points)
Code: function run_animate(sprite,points)
RE: animations in murgalua - iGame3D - 05-28-2007 12:31 PM This is awesome, I'm glad you found it something you could roll with. Can't wait to see what happens next... RE: animations in murgalua - chrimo - 05-29-2007 08:10 AM Hi, WOW, cool! This very interesting example of lua programming answers many of my beginners questions ![]() Thanks for more Bye Christian RE: animations in murgalua - mikshaw - 05-29-2007 09:52 PM This is a groovy test. I'm wondering if I'm seeing it the way it's supposed to be, though. Rather than gradually moving across the window as I expected, the car appears to leap very quickly between a pair of points. It seems to be animated in the sense that I can see the car very briefly at a middle point, but the movement is so quick I'm not sure if it isn't just an optical illusion or if the car is being redrawn as quickly as possible (no wait) at each point along the curve. Using murgaLua 0.4.1 on Slackware and Damn Small Linux RE: animations in murgalua - iGame3D - 05-30-2007 12:08 AM At the bottom of lib/bezier.lua Code: function run_anim(srpite,points)
Code: function run_anim(srpite,points)
Code: function run_anim(sprite,points)
RE: animations in murgalua - mikshaw - 06-23-2007 05:57 PM Attached is an animated image sequence demo. It uses a repeat button as a cheat for an actual loop, which I guess should not be needed with murgaLua 0.5 From John's recent drawing tests it seems like it could be done in 0.4.1, but I don't quite understand how =o) RE: animations in murgalua - iGame3D - 06-25-2007 10:36 AM Ok here's my version. Auto Plays on start. Space bar starts and stops the animation and you can control the animation speed in the script. RE: animations in murgalua - mikshaw - 06-25-2007 11:31 AM That's pretty cool. I definitely have to look into that autoplay. Unfortunately it will need some tweaks to work on my system. The animation doesn't "animate", in that there is usually a set number of frames per second in an animation but this one tore through the frames so violently that it skipped most of them, my cpu went crazy, and my desktop froze =o) I wonder if this is a similar issue to the one I had with the cars RE: animations in murgalua - JohnMurga - 06-27-2007 10:01 AM It is all related to this ... http://www.murga-projects.com/forum/showthread.php?tid=38&pid=228#pid228 I guess the busy loops don't have as much of an impact on MacOS, so iGame3D is OK ... But they are a killer on Win32 or Linux unless you have some kinda delay to let the system catch up ... Currently the only way to do that to less than a second is to use something like this : http://www.murga-projects.com/forum/showthread.php?tid=59&pid=227#pid227 0.5 does have a nicer sleep, and might have timeout callbacks too. I'll publish my release plans for that tomorrow. Cheers JohnM |