J
Jimmy
I'm new to animation in Java. Can someone help me out? Thanks.
I want to create a moving cat & a moving mouse (chasing from left to
right) inside a JPanel. When this cat's mouth touches the mouse's
tail, I need to trigger an event to do something.
- what instance (from standard Java SE 6) can I used to create these
moving animals?
- in 2D only, is there just 1 point (x,y) of the animal (e.g. center
of animal's chest) to control it to move from left to right (e.g. a
loop to increment x-coordinate)
- for the 2nd/previous point above, how I can ensure the animal's head
did went past the end (e.g. right) of the window, as the cat is
chasing the mouse from left to right.
- assuming I can use an animated GIF inside java.awt.Rectangle, then
use intersects(Rectangle r) method to check if the cat's rectangle
intersects the mouse's rectangle ... but what if I need more details
as some point, the cat's front legs may be at mouse's position the
cat's mouth is not 'touching' mouse's tail yet?
Thank you,
Jimmy
I want to create a moving cat & a moving mouse (chasing from left to
right) inside a JPanel. When this cat's mouth touches the mouse's
tail, I need to trigger an event to do something.
- what instance (from standard Java SE 6) can I used to create these
moving animals?
- in 2D only, is there just 1 point (x,y) of the animal (e.g. center
of animal's chest) to control it to move from left to right (e.g. a
loop to increment x-coordinate)
- for the 2nd/previous point above, how I can ensure the animal's head
did went past the end (e.g. right) of the window, as the cat is
chasing the mouse from left to right.
- assuming I can use an animated GIF inside java.awt.Rectangle, then
use intersects(Rectangle r) method to check if the cat's rectangle
intersects the mouse's rectangle ... but what if I need more details
as some point, the cat's front legs may be at mouse's position the
cat's mouth is not 'touching' mouse's tail yet?
Thank you,
Jimmy