summary refs log tree commit diff stats
path: root/src/com/fourisland/fourpuzzle/gamestate/GameOverGameState.java
blob: ebff457c08dfcb793bf4f7c9ebc6f29b55a2c1f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.fourisland.fourpuzzle.gamestate;

import com.fourisland.fourpuzzle.Audio;
import com.fourisland.fourpuzzle.Display;
import com.fourisland.fourpuzzle.Game;
import com.fourisland.fourpuzzle.SaveFile;
import com.fourisland.fourpuzzle.transition.SquareTransition;
import com.fourisland.fourpuzzle.util.ObjectLoader;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author hatkirby
 */
public class GameOverGameState implements GameState {
    
    public void initalize() throws Exception
    {
        Audio.playMusic("GameOver");
    }
    
    public void deinitalize() throws Exception
    {
        Audio.stopMusic();
    }

    public void processInput() throws Exception {
        if ((Game.getKey().getKeyCode() == KeyEvent.VK_ENTER) || (Game.getKey().getKeyCode() == KeyEvent.VK_SPACE))
        {
            Game.setSaveFile(new SaveFile());
            //Display.transition(SquareTransition.class, this, new TitleScreenGameState());
            Display.transition(new SquareTransition(true), new Runnable() {
                public void run() {
                    try {
                        Game.setGameState(new TitleScreenGameState());
                    } catch (Exception ex) {
                        Logger.getLogger(GameOverGameState.class.getName()).log(Level.SEVERE, null, ex);
                    }
                }
            });
        }
    }

    public void doGameCycle() throws Exception {
        // Do nothing
    }

    public void render(Graphics2D g) throws Exception {
        g.drawImage(ObjectLoader.getImage("Picture", "GameOver"), 0, 0, null);
    }

}