wood burning stoves 2.0*
The moose likes Game Development and the fly likes Graphics Lag on Certain Computers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Game Development
Bookmark "Graphics Lag on Certain Computers" Watch "Graphics Lag on Certain Computers" New topic
Author

Graphics Lag on Certain Computers

Justin Vasquez
Greenhorn

Joined: Jul 05, 2011
Posts: 5

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
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3596
    
  14

I have to say, I really like the concept of your game.

It runs smoothly for me, maybe you can post your code and we can see where you can make some improvements.
Justin Vasquez
Greenhorn

Joined: Jul 05, 2011
Posts: 5

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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Graphics Lag on Certain Computers
 
Similar Threads
Make an Image disappear and appear at random
AffineTransform "transform" method
Make JTable With Images More Responsive?
Chess Server
image transparency