This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

danpost
danpost presents ...

2015/6/24

Animation Support Class

A simple class to aid in animating the image of Actor objects or the background image of World objects.

TO USE:
(1) Add a field to the World or Actor subclass to hold an Animation object;
(2) build an array of GreenfootImage objects to be used in the animation (frame images);
(3) create and assign a new Animation object to the field declared in (1) above;
(4) set the cycle time (see 'cycleActs' field and related methods);
(5) activate the Animation object (see the 'activeState' field and related methods);
(6) run the animation from the act method of the class (see the 'run' method);

DEMO CONTROLS:

Arrow keys regulate the speed of the animations:
'up/down' controls Actor object animation time
'left/right' controls World object animation time
The higher (or longer) the time, the slower the animation; lower times yeild faster animations.

Press 'd' to reverse the images in the World background animation (the animation will appear to run backward).

Press '0', '1', '2' and '3' to change the animation image set for the Actor object. The '1' image set will execute 6 cycles and then the image set will change back to the '0' set automatically.

Click on Actor object to remove it from the world.

5093 views / 31 in the last 7 days

3 votes | 0 in the last 7 days

Tags: demo with-source animation danpost support

This scenario is a member of: Support Classes by danpost


open in greenfoot
Your browser is ignoring the <APPLET> tag.
A new version of this scenario was uploaded on 2015-06-24 13:55:11 UTC
A new version of this scenario was uploaded on 2017-10-16 01:50:55 UTC
A new version of this scenario was uploaded on 2017-10-16 02:03:00 UTC

Want to leave a comment? You must first log in.

Who likes this?

data17 TomazVDSN davemib123