This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, I've been learning how to program in Java for a while now, and made a small game to see what I could implement (Here's the compiled version: Burger)
I'm obviously doing something wrong with the screen refreshing, and I need a more efficient method. I made a separate thread that repaints the screen, and it sleeps for 3 miliseconds. If I make it sleep more, the game is very slow (the guy moves one pixel at a time, by the way).
On certain computers, the game runs fine (you can get 40 + points). On others, you can barely get a piece of food before dying. Can anyone help me with this? I've heard of buffered images (I just use images) , but I have no idea how to use them.
Also, I wouldn't mind receiving some feedback on the game and what I should add
Here is the main part of the code (although I cut a lot)
I also have a class called Stick, which is basically the character. This class loads the images and handles which one to use (I cut some stuff here too)
And this is the Mover class. It's the Action Listener for the game. I have a boolean array that represents the arrow keys. If one is pressed, it becomes true and all the others become false.
Again, it's incomplete.
I also have a Meal class, which handles the food that appears on-screen. Since I'm having problems with the graphics, I didn't post that.
I hope this is enough to find a solution.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com