src/Game.java
/**
     * Run method since Game is a runnable
     */
Run method since Game is a runnable
Run method since Game is a runnable
public void run(){
        init();
        long lastTime = System.nanoTime();
        double amountOfTicks = 60.0;
        double ns = 1000000000 / amountOfTicks;
        double delta = 0;
        long timer = System.currentTimeMillis();
        int updates = 0;
        int frames = 0;
        while(running){
            try{
                KeyInput.process();
            }catch(ConcurrentModificationException err){
                System.out.println();
            }            
            long now = System.nanoTime();
            delta += (now - lastTime) / ns;
            lastTime = now;
            for(;delta >= 1;delta--){
                this.update();
                updates++;
            }
            this.draw();
            frames++;
            if(Game.gameState.equals("game") && Game.level != 4){
                if(frames%2==0) score = Math.max(score-1,0);
                if(frames%100==0) player.tick();
            }
            if(System.currentTimeMillis() - timer > 1000){
                timer += 1000;
                frames = 0;
                updates = 0;
            }
        }
    }
public void run ( ) { init ( ) ; long lastTime = System . nanoTime ( ) ; double amountOfTicks = 60.0 ; double ns = 1000000000 / amountOfTicks ; double delta = 0 ; long timer = System . currentTimeMillis ( ) ; int updates = 0 ; int frames = 0 ; while ( running ) { try { KeyInput . process ( ) ; } catch ( ConcurrentModificationException err ) { System . out . println ( ) ; } long now = System . nanoTime ( ) ; delta += ( now - lastTime ) / ns ; lastTime = now ; for ( ; delta >= 1 ; delta -- ) { this . update ( ) ; updates ++ ; } this . draw ( ) ; frames ++ ; if ( Game . gameState . equals ( "game" ) && Game . level != 4 ) { if ( frames % 2 == 0 ) score = Math . max ( score - 1 , 0 ) ; if ( frames % 100 == 0 ) player . tick ( ) ; } if ( System . currentTimeMillis ( ) - timer > 1000 ) { timer += 1000 ; frames = 0 ; updates = 0 ; } } }
Run method since Game is a runnable
Run method since Game is a runnable
// Initialize needed variables
 // Time variables
 // Game loop
 // Process the keys being pressed
 // Score and player tick
