Topic awaiting preservation: addActionListener and sprites (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Back in West Texas... How disappointing |
posted 10-22-2004 17:44
I'm working on a project (different one from the one with the CLI, which I have yet to get back to...), but I've already got our sprites so that I can script movements in a .txt file, and I even have sounds and narrations playing, and everything is synched up and beautiful (well, ok, I have a couple slight bugs to iron out, but nothing a few hours won't fix). |
Maniac (V) Mad Scientist From: Rochester, New York, USA |
posted 10-24-2004 05:06
If you are keeping track of the sprite location (which you must be doing), you can add a mouse motion listener to the frame and keep track of the mouse location clicks and such, with a small algorithm you will find out which sprites are being affected. In your sprite class you can also make it so you just supply the x and y locaitons and have it return a boolean based on if a collision occured or not. |
Paranoid (IV) Inmate From: Back in West Texas... How disappointing |
posted 10-25-2004 19:28
The sprites are keeping track of their own position. I have an ArrayList of sprites that are in use, and my sprite class has an update method which updates its position (and whatever else needs updated), then they are drawn to the screen. I suppose I can do something similar to check for a collision; run through my list of sprites in use and get their position and size to check for a colision. |
Maniac (V) Mad Scientist From: Somewhere over the rainbow |
posted 10-25-2004 19:46
The poster has demanded we remove all his contributions, less he takes legal action. |
Paranoid (IV) Inmate From: Back in West Texas... How disappointing |
posted 10-25-2004 21:52
Works just fine now, thanks again WM |