I got code from an internet tutorial:
//Advance animation frame.
frameNumber = frameNumber + 8;
//Display it.
spriteLabel.setLocation (((frameNumber * 5) % (spriteWidth + bgWidth))
- spriteWidth, (bgHeight - spriteHeight) / 2);
framenumber = speed, sprite = image, bg = background
this would make it move to the right. and i could change the speed by changing the frame number.
there is a timer also that makes the image move over and over
also by playing around with it i made it to this code to make it go up and down.
//Advance animation frame.
frameNumber = frameNumber + 25;
//Display it.
spriteLabel.setLocation (((bgHeight + spriteHeight) / 2), ((frameNumber * 5) % (bgHeight - spriteHeight)));
the problem that i’m having, is that i need to make a duck hunter game where ducks are moving all around the place and i have to shoot them down, i got the problem of shooting them done with mouselistener
now the problem i have is combining those two pieces of code and making an image do complicated movements.
any help would be appreciated.
i’m also having a problem with changing the image after i click it, but ill probably find a way to fix that by playing around with it.
thanks.