|
AnimImage |
|
/*
* JVirus is a PacMan clone, written in Java.
*
* Please read "http://jvirus.sourceforge.net/jvirus_licence.txt" for copyrights.
*
* The sourcecode is designed and created with
* Sun J2SDK 1.3 and Microsoft Visual J++ 6.0
*
* JVirus homepage: http://jvirus.sourceforge.net
*
* autor: Slawa Weis
* email: slawaweis@animatronik.net
*
*/
package org.game.JVirus;
import java.awt.Image;
/**
* simply a array if images.
*/
public class AnimImage
{
/**
* image array
*/
protected Image array[] = null;
/**
* current image number
*/
protected int number = 0;
/**
* simply constructor
*
* @param img_arr list with images
*/
public AnimImage(Image [] img_arr)
{
array = new Image[img_arr.length];
for(int i = 0; i < array.length; i++)
array[i] = img_arr[i];
}
/**
* reset image counter to 0
*/
public void reset()
{
number = 0;
}
/**
* get the current image. If index of the array is >=, then set index zo 0 and start from beginning.
*/
public Image nextImage()
{
if(number >= array.length)
number = 0;
return array[number++];
}
}
|
AnimImage |
|