Moving+Rotating target

hi all,

first thanks for this wonderful resource for java-game-developers.

i am currently working on a simple point+shoot game in java. And i have 2 questions
regarding the implementation :

Serveral coke cans (100x100 pixels) are running from left of the screen to right
of screen while rotating (fullscreen). Your mousepointer is a crosshair and you have to
shoot the cans. Depending on where u hit them they explode or get scratches etc.

and now the questions :

  • is the java2d-api perfomance fast enough to handle the rotation of multiple “cans” on
    the screen or should i use an image animation with pre-rotated “cans”

  • what’s the best way to handle the click/hit-areas on the “cans” while they are rotating ? (Shape->Poly ?)

Hopefully this posts fits into the right section of the forum :slight_smile: … and excuse my bad english …

Thanks,

bibo

[quote]hi all,

first thanks for this wonderful resource for java-game-developers.

i am currently working on a simple point+shoot game in java. And i have 2 questions
regarding the implementation :

Serveral coke cans (100x100 pixels) are running from left of the screen to right
of screen while rotating (fullscreen). Your mousepointer is a crosshair and you have to
shoot the cans. Depending on where u hit them they explode or get scratches etc.

and now the questions :

  • is the java2d-api perfomance fast enough to handle the rotation of multiple “cans” on
    the screen or should i use an image animation with pre-rotated “cans”
    [/quote]
    prerotate them, not only is AffineTransform rather slow, it prevents the images from being hardware accelerated.

[quote]- what’s the best way to handle the click/hit-areas on the “cans” while they are rotating ? (Shape->Poly ?)
[/quote]
Are the Cans rectangular?
if so, u can just do it with oriented bounding boxes.

If they arn’t rectangular, then i’d do a 2 layer collision detection, 1st axis aligned bounding box, then polygonal.

thx :slight_smile:

i will do it this way :smiley: