-
2d animation in java...
Hi,
I am creating a simple starwars-style space shooter in java. I have my starfield,
which I wrote. Also, I have a spaceship image. I want to have the starfield
loop run on one thread and the image controlled by key events on another
thread. The problem is that I can't get any Graphics to work with the run()
method!
so for instance, if I have a thread called Sfield, i want to run the Sfield
graphic animation in one thread, i tried the following..
SpaceWar thread1 = new SpaceWar();
Thread war = new Thread(thread1);
war.start();
//Thats my thread initialization for one thread.
then in the run method...
public void run(Graphics g)
{
g.drawImage(...
}
I get an error beacause I can't use the graphics g object in this method!
How would I use the g.drawImage line in a seperate thread?
Thanks in advance, Dr CrE.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks