Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Snake Game Threads Problem
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rhomer0




PostPosted: Wed Feb 16, 2005 8:21 pm   Post subject: Snake Game Threads Problem

Hey I can't get the thread in Game.java to work. It's supposed to keep moving even when no buttons are pressed.


Snake.zip
 Description:

Download
 Filename:  Snake.zip
 Filesize:  8.21 KB
 Downloaded:  176 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
rizzix




PostPosted: Thu Feb 17, 2005 11:46 am   Post subject: (No subject)

All swing components are rendered in an Event Thread. And the thing is your trying to access data being modifed by two threads (Game and SWING).. you need to synchronize "an" object before accessing the static variables of the Game class, in both classes and also when calling methods of the opposite class.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: