I'm Hajime Hoshi, one of the Star Ruby developers.
Thank you for your using Star Ruby!
2009/6/15 Merkoth <mer...@gmail.com>
>
> Hi, I'm new here and I'm just getting started with both Ruby and Star
> Ruby. I was wondering if it's possible to get the delta time of each
> frame, to be able to implement framerate-independent movement.
> Something like this:
>
> class Ship
> def intiialize
> # ...
> end
> def update(delta_time)
> x += speed * delta_time
> u += speed * delta_time
> end
> def draw
> # ...
> end
> end
Please use Game.ticks method. It returns elapsed time in millisecond
from stating your program. Please let me know if this answers your
question.
> My best guess would be to use a timer, but I don't really understand
> from the timer.rb example how to implement a custom timer. However,
> since Star Ruby seems to run at a fixed framerate I wonder if this is
> really necessary. Does Star Ruby only fix the drawing rate or the
> entire program?
Star Ruby (Game.run method) fixes the entire program. timer.rb only
shows how to use some methods like Game.ticks, Game#fps, not to
implement original timers.
Thanks,
--
Hajime Hoshi <hajim...@gmail.com>
> Please use Game.ticks method. It returns elapsed time in millisecond
> from stating your program. Please let me know if this answers your
> question.
I was looking for the time since the last frame update, not since
starting my program but...
> Star Ruby (Game.run method) fixes the entire program. timer.rb only
> shows how to use some methods like Game.ticks, Game#fps, not to
> implement original timers.
... if it really sets a fixed execution speed, using frame deltas
isn't necessary.
Thanks for the information! :)
--
Ren | | Merkoth