hi, im a noob programmer but i understand something about java. I watched all the video tutorials about java gamimg, but now I want to convert the game into applet but i can't, specially because it doesn't support loops :S
And if I use the method repaint() the FPS get too low...
//Called when this applet is loaded into the browser. public void init() { addMouseListener(this); addMouseMotionListener(this); addMouseWheelListener(this); mess="press escape to exit"; setForeground(Color.WHITE); loadImages(); //Execute a job on the event-dispatching thread; creating this applet's GUI. try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { startingTime=System.currentTimeMillis(); cumTime= startingTime; timePassed = System.currentTimeMillis() - cumTime; cumTime+=timePassed; while(running){ update(timePassed); updatePrisao( timePassed); preso1.update(timePassed); preso2.update(timePassed); preso3.update(timePassed); preso4.update(timePassed); repaint(); try{ Thread.sleep(20); }catch(Exception ex){} } } } ); } catch (Exception e) { System.err.println("createGUI didn't complete successfully"); } }
i dont put the repaint becouse i dont now where i go put :S
if i do a while using a boolean the applet crashes