File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Thread help with a tetris game Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Thread help with a tetris game" Watch "Thread help with a tetris game" New topic
Author

Thread help with a tetris game

Paul Robinson
Greenhorn

Joined: Feb 24, 2006
Posts: 1
Hi there,

I am having some trouble with my code, and the main problem is that im not sure what the problem is.
I have a fairly standard game -> canvas -> layer manager setup with 2 threads, one for key checking and one for normal movement setup.
The game is tetris by the way. the problem is, it works well until i happen to be holding the down button and completing a line at the same time, i have tried to figure this out but it makes no sense, i have written synchronized in all the right places (i think) and everything like that but it still does some pretty weird stuff.

If anyone would like to look at this i would greatly appreciate it, someone with more of an understanding of threads would be awesome. and maybe even a little reward for an explaination.

the code for my game is at http://www.michaelrobinsonphotography.com/family/tmp/tetris.zip

Sweet, Thanks
Paul
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282


See: Singleton class private constructor woes

Double-Checked Locking is Broken

The issues are not immediately apparent, but the overall game design makes sense except for where is your main() ?


"The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Thread help with a tetris game