This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Advanced Topics
  •  » Make animations play at the same rate- online/offline/slow computers

#1 2010-01-30 03:14:28

AddZero
Scratcher
Registered: 2007-08-11
Posts: 100+

Make animations play at the same rate- online/offline/slow computers

I ran into this solution working on my current project, I hope it's helpful.

If you have a fast computer compared to other scratchers, you may make animations/movement that runs well on your computer- but others complain that it's slow.

http://scratch.mit.edu/static/projects/AddOne/866265_sm.png
http://scratch.mit.edu/projects/AddOne/866265

Hold the mouse button to draw many lines at once.

The top cat uses the usual method for movement.  It moves 4 spaces in a loop.

When you hold the mouse button, frames take longer to draw, so the top cat slows down.

Even though it skips frames, the bottom cat stays moving at the same rate because it is using the timer to determine how far it should move.

This method will allow you to make many types of animation work at the same speed on fast and slow computers, online or off.

Skipping frames instead of slowing down is not a new idea. It happens in modern games and video players when the system bogs down.

There are probably much better ways of doing this.  But the idea is that the animation is based off the timer instead of incrementing the same amount each frame. 

Feel free to run with this idea. 
Just please leave me a comment and let me know how it works out for you.

And let me know if you have questions.  smile

Last edited by AddZero (2010-01-30 03:19:06)


http://scratch.mit.edu/static/icons/buddy/524717_med.png?t=2010-06-15+09%3A48%3A36

Offline

 

#2 2010-01-30 03:19:25

what-the
Scratcher
Registered: 2009-10-04
Posts: 1000+

Re: Make animations play at the same rate- online/offline/slow computers

Nice. That would be useful if timing is crucial.


http://imageshack.us/m/64/9034/ddfss.pngMy site
Find someone post count. Click posts under username. Find number of pages. Times that by 40 for min and 60 for max and you have a rough estimate of post count.

Offline

 

#3 2010-01-30 04:18:20

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Make animations play at the same rate- online/offline/slow computers

You could also implement this into games... I think...


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#4 2010-01-30 12:55:14

AddOne
Scratcher
Registered: 2009-11-16
Posts: 1

Re: Make animations play at the same rate- online/offline/slow computers

juststickman wrote:

You could also implement this into games... I think...

Yes, I haven't worked it into sprites with velocity well yet, but I think it can be done.  For linear movement and animation it's easy to add and works well.
btw though, if you do use this for more than one sprite, the [spf = lastTimer - timer] [lastTimer = timer] should only be in one place, in it's own loop somewhere.


Previously AddZero.  New name, same great service!

Offline

 
  • Index
  •  » Advanced Topics
  •  » Make animations play at the same rate- online/offline/slow computers

Board footer