Wednesday, 31 December 2008

RippleA - rippling water sprite

Here is RippleA, intended to simulate rippling water. It can be seen on the first page of the sample code.

It uses the Sprite.increment() method to change the image at any given time.

It isn't very realistic - perhaps a slower (setCommonTime())

public class RippleA extends Sprite
{
public RippleA(String spriteName, String Scenename)
{
super(spriteName, Scenename, "ripplea.jpg", MULTIPLE,
4, UNMOVING, NOACTION);
setCommonTime(1);
setPosition(0, 360);
setSize(640, 120);
}
public void tick(long ticks, int mousex, int mousey)
{
super.increment(ticks);
}
}

No comments: