1 / 7

Animating Actors In Greenfoot

Animating Actors In Greenfoot. To create an animated actor, you must first: Create a series of images. The images must begin with the same name FOLLOWED by the number for which order you want the images animated. For example:.

lee-dickson
Télécharger la présentation

Animating Actors In Greenfoot

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Animating Actors In Greenfoot

  2. To create an animated actor, you must first: • Create a series of images. • The images must begin with the same name FOLLOWED by the number for which order you want the images animated. • For example:

  3. Once you have your images, you must place them in the “images” folder of your scenario. • You will then need to create subclasses of your Actor class. • Create a Mover class  The support file is on the Greenfoot website. • Create an AnimatedActor class  The support file is on the Greenfoot website.

  4. You must copy the code from those support classes into the code for the Mover and AnimatedActor classes. • After you do this add your class you wish to animate as a subclass to the AnimatedActor class. Ex:

  5. Add the following code to your class: • Ex: This is the filename extension of your files. This is the number of files you are animating. This is the first part of the name of your image files.

  6. public class Bullet extends AnimatedActor { public Bullet( ) { super("bullet", ".png", 3); } public void act( ) { super.act( ); } } • What does “super” mean? • Super calls the superclass’ constructor. • Also, the super keyword gives you access to the superclass’ methods and variables. • In this example, AnimatedActor is the superclass of the Bullet class.

More Related