I've just finished my first term at uni, and learnt some java.
I'm creating a simple helicopter game in java, and have some issues using timers.
The funny thing was, i started the project on my laptop, and it was going fine. Went back to my desktop, and it lagged. Weird. So I tried it on my laptop again, and it had no lag.
By lag, I mean graphically and mouse movement when the application runs. Its not consuming resources, so that's not the problem.
I read something on a forum about it being to do with the fact my desktop has a quad core. If this is the case, how can I work around this? Obviously I will have to use my laptop for now. Laptop is dual core running vista, desktop is a quad core running xp sp3.
code listing below. 2 separate files but together for this forum
public class HeliApp extends Object
public static void main(String argStrings) throws Exception
JFrame frame = new JFrame ("Heli");
frame.getContentPane().add (new HeliPanel());
public class HeliPanel extends JPanel
int heliX = 50;
int heliY = 200;
int yMove = 5;
private ImageIcon image;
int delay = 20;
private Timer timer;
image = new ImageIcon ("../black-helicopter.gif");
setPreferredSize (new Dimension(1000,400));
Timer timer = new Timer(10, new GameListener());
public void paintComponent (Graphics page)
image.paintIcon (this,page,heliX, heliY);
private class GameListener implements ActionListener
public void actionPerformed (ActionEvent event)
heliY = heliY + yMove;