Computer Science Canada

Snake Game Threads Problem

Author:  rhomer0 [ 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.

Author:  rizzix [ Thu Feb 17, 2005 11:46 am ]
Post 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.


: