| @@ -0,0 +1,235 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseListener; | ||
| import java.awt.event.MouseMotionListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseInput implements MouseListener, MouseMotionListener{ | ||
|
|
||
| @Override | ||
| public void mouseClicked(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseEntered(MouseEvent e) { | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseExited(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mousePressed(MouseEvent e) { | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| //Main Menu | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| StateManager.game = null; | ||
| StateManager.characterSelect = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.settings = null; | ||
| StateManager.gameState = GameState.SETTINGS; | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| StateManager.gameState = GameState.EXIT; | ||
| } | ||
| } | ||
| //Settings | ||
| else if(StateManager.gameState == GameState.SETTINGS) | ||
| { | ||
| //Music | ||
| if(MainMenu.musicOn==true) | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.musicOn = false; | ||
| } | ||
|
|
||
| } | ||
| else | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.musicOn = true; | ||
| MainMenu.music = new AudioPlayer("res/menuMusic.wav"); | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
| //SFX | ||
| if(mx>585 && mx<685 && my>281 && my<378) | ||
| { | ||
| MainMenu.sfxOn = !MainMenu.sfxOn; | ||
| } | ||
| //Back | ||
| if(mx>820 && mx<880 && my>15 && my<50) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.CHARACTERSELECT) | ||
| { | ||
| if(CharacterSelect.playerOneChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Luigi"; | ||
| } | ||
| } | ||
| else if(CharacterSelect.playerTwoChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Luigi"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| StateManager.mapSelect = null; | ||
| StateManager.gameState = GameState.MAPSELECT; | ||
| StateManager.characterSelect = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.MAPSELECT) | ||
| { | ||
| if(MapSelect.mapName == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.mapSelect = null; | ||
| StateManager.game = null; | ||
| StateManager.game2 = null; | ||
| if(MapSelect.mapName.equals("Freefall")) | ||
| StateManager.gameState = GameState.GAME; | ||
| else if (MapSelect.mapName.equals("Hellfire")) | ||
| StateManager.gameState = GameState.GAME2; | ||
| StateManager.characterSelect = null; | ||
| StateManager.mapSelect = null; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseReleased(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public void mouseDragged(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseMoved(MouseEvent e) { | ||
|
|
||
| //Main Menu | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,41 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseMotionListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseMotionInput implements MouseMotionListener{ | ||
|
|
||
| @Override | ||
| public void mouseDragged(MouseEvent arg0) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseMoved(MouseEvent arg0) { | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,227 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseInput implements MouseListener{ | ||
|
|
||
| @Override | ||
| public void mouseClicked(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseEntered(MouseEvent e) { | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseExited(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mousePressed(MouseEvent e) { | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| //Main Menu | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| StateManager.game = null; | ||
| StateManager.characterSelect = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.settings = null; | ||
| StateManager.gameState = GameState.SETTINGS; | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| StateManager.gameState = GameState.EXIT; | ||
| } | ||
| } | ||
| //Settings | ||
| else if(StateManager.gameState == GameState.SETTINGS) | ||
| { | ||
| //Music | ||
| if(MainMenu.musicOn==true) | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.musicOn = false; | ||
| } | ||
|
|
||
| } | ||
| else | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.musicOn = true; | ||
| MainMenu.music = new AudioPlayer("res/menuMusic.wav"); | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
| //SFX | ||
| if(mx>585 && mx<685 && my>281 && my<378) | ||
| { | ||
| MainMenu.sfxOn = !MainMenu.sfxOn; | ||
| } | ||
| //Back | ||
| if(mx>820 && mx<880 && my>15 && my<50) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.CHARACTERSELECT) | ||
| { | ||
| if(CharacterSelect.playerOneChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Luigi"; | ||
| } | ||
| } | ||
| else if(CharacterSelect.playerTwoChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Luigi"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| StateManager.mapSelect = null; | ||
| StateManager.gameState = GameState.MAPSELECT; | ||
| StateManager.characterSelect = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.MAPSELECT) | ||
| { | ||
| if(MapSelect.mapName == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.mapSelect = null; | ||
| StateManager.game = null; | ||
| StateManager.game2 = null; | ||
| if(MapSelect.mapName.equals("Freefall")) | ||
| StateManager.gameState = GameState.GAME; | ||
| else if (MapSelect.mapName.equals("Hellfire")) | ||
| StateManager.gameState = GameState.GAME2; | ||
| StateManager.characterSelect = null; | ||
| StateManager.mapSelect = null; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseReleased(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| public void nice(MouseEvent e) | ||
| { | ||
| //Main Menu | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| MainMenu.sfx1.stop(); | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,206 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseInput implements MouseListener{ | ||
|
|
||
| @Override | ||
| public void mouseClicked(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseEntered(MouseEvent e) { | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseExited(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mousePressed(MouseEvent e) { | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| //Main Menu | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| StateManager.game = null; | ||
| StateManager.characterSelect = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.settings = null; | ||
| StateManager.gameState = GameState.SETTINGS; | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| StateManager.gameState = GameState.EXIT; | ||
| } | ||
| } | ||
| //Settings | ||
| else if(StateManager.gameState == GameState.SETTINGS) | ||
| { | ||
| //Music | ||
| if(MainMenu.musicOn==true) | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.musicOn = false; | ||
| } | ||
|
|
||
| } | ||
| else | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.musicOn = true; | ||
| MainMenu.music = new AudioPlayer("res/menuMusic.wav"); | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
| //SFX | ||
| if(mx>585 && mx<685 && my>281 && my<378) | ||
| { | ||
| MainMenu.sfxOn = !MainMenu.sfxOn; | ||
| } | ||
| //Back | ||
| if(mx>820 && mx<880 && my>15 && my<50) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.CHARACTERSELECT) | ||
| { | ||
| if(CharacterSelect.playerOneChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Luigi"; | ||
| } | ||
| } | ||
| else if(CharacterSelect.playerTwoChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Luigi"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| StateManager.mapSelect = null; | ||
| StateManager.gameState = GameState.MAPSELECT; | ||
| StateManager.characterSelect = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.MAPSELECT) | ||
| { | ||
| if(MapSelect.mapName == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.mapSelect = null; | ||
| StateManager.game = null; | ||
| StateManager.game2 = null; | ||
| if(MapSelect.mapName.equals("Freefall")) | ||
| StateManager.gameState = GameState.GAME; | ||
| else if (MapSelect.mapName.equals("Hellfire")) | ||
| StateManager.gameState = GameState.GAME2; | ||
| StateManager.characterSelect = null; | ||
| StateManager.mapSelect = null; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseReleased(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| public void nice(MouseEvent e) | ||
| { | ||
|
|
||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,54 @@ | ||
| package data; | ||
|
|
||
| import java.awt.Graphics; | ||
| import java.awt.Image; | ||
|
|
||
|
|
||
| import javax.swing.ImageIcon; | ||
|
|
||
| public class MainMenu { | ||
|
|
||
| public static final int WIDTH = 900, HEIGHT = 450; //Default | ||
| public static boolean musicOn; | ||
| public static boolean sfxOn; | ||
|
|
||
| private Image menuBG; | ||
| public static AudioPlayer music; | ||
| public static AudioPlayer sfx1; | ||
| public static AudioPlayer sfx2; | ||
| private UI menuUI; | ||
| private Image play, settings, exit; | ||
| public MainMenu() | ||
| { | ||
| this.menuBG = new ImageIcon(getClass().getClassLoader().getResource("res/mainmenu.png")).getImage(); | ||
| this.play = new ImageIcon(getClass().getClassLoader().getResource("res/play.png")).getImage(); | ||
| this.settings = new ImageIcon(getClass().getClassLoader().getResource("res/settings.png")).getImage(); | ||
| this.exit = new ImageIcon(getClass().getClassLoader().getResource("res/exit.png")).getImage(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| MainMenu.sfx1 = new AudioPlayer("res/buttonEffect.wav"); | ||
| MainMenu.musicOn = true; | ||
| MainMenu.sfxOn = true; | ||
| this.menuUI = new UI(); | ||
| menuUI.addButton("Play", play, 650, 135, 167, 100); | ||
| menuUI.addButton("Settings", settings, 637, 240, 200, 100); | ||
| menuUI.addButton("Exit", exit, 650, 345, 167, 100); | ||
| if(MainMenu.musicOn == true) | ||
| music.play(); | ||
| if(MainMenu.sfxOn == true){ | ||
| sfx1.play(); | ||
| sfx1.close(); | ||
| } | ||
| } | ||
|
|
||
| private void updateButtons() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| public void update(Graphics g) | ||
| { | ||
| g.drawImage(menuBG, 0, 0, WIDTH, HEIGHT, null); | ||
| menuUI.draw(g); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,202 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseListener; | ||
| import java.awt.event.MouseMotionListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseInput implements MouseListener{ | ||
|
|
||
| @Override | ||
| public void mouseClicked(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseEntered(MouseEvent e) { | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseExited(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mousePressed(MouseEvent e) { | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| //Main Menu | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| StateManager.game = null; | ||
| StateManager.characterSelect = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.settings = null; | ||
| StateManager.gameState = GameState.SETTINGS; | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| StateManager.gameState = GameState.EXIT; | ||
| } | ||
| } | ||
| //Settings | ||
| else if(StateManager.gameState == GameState.SETTINGS) | ||
| { | ||
| //Music | ||
| if(MainMenu.musicOn==true) | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.musicOn = false; | ||
| } | ||
|
|
||
| } | ||
| else | ||
| { | ||
| if(mx>585 && mx<685 && my>148 && my<245) | ||
| { | ||
| MainMenu.musicOn = true; | ||
| MainMenu.music = new AudioPlayer("res/menuMusic.wav"); | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
| //SFX | ||
| if(mx>585 && mx<685 && my>281 && my<378) | ||
| { | ||
| MainMenu.sfxOn = !MainMenu.sfxOn; | ||
| } | ||
| //Back | ||
| if(mx>820 && mx<880 && my>15 && my<50) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.CHARACTERSELECT) | ||
| { | ||
| if(CharacterSelect.playerOneChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerOneChar = "Luigi"; | ||
| } | ||
| } | ||
| else if(CharacterSelect.playerTwoChar == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Mario"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| CharacterSelect.playerTwoChar = "Luigi"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| StateManager.mapSelect = null; | ||
| StateManager.gameState = GameState.MAPSELECT; | ||
| StateManager.characterSelect = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| StateManager.gameState = GameState.MAINMENU; | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| if(MainMenu.musicOn) | ||
| MainMenu.music.play(); | ||
| } | ||
| } | ||
|
|
||
| else if(StateManager.gameState == GameState.MAPSELECT) | ||
| { | ||
| if(MapSelect.mapName == null) | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| } | ||
| else | ||
| { | ||
| if(mx>75 && mx<368 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Freefall"; | ||
| } | ||
| else if(mx>520 && mx<815 && my>100 && my<399) | ||
| { | ||
| MapSelect.mapName = "Hellfire"; | ||
| } | ||
| if(mx>380 && mx <510 && my>400 && my<435) | ||
| { | ||
| MainMenu.music.stop(); | ||
| MainMenu.music.close(); | ||
| StateManager.mapSelect = null; | ||
| StateManager.game = null; | ||
| StateManager.game2 = null; | ||
| if(MapSelect.mapName.equals("Freefall")) | ||
| StateManager.gameState = GameState.GAME; | ||
| else if (MapSelect.mapName.equals("Hellfire")) | ||
| StateManager.gameState = GameState.GAME2; | ||
| StateManager.characterSelect = null; | ||
| StateManager.mapSelect = null; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
| if(mx>830 && mx<890 && my>400 && my<435) | ||
| { | ||
| StateManager.characterSelect = null; | ||
| CharacterSelect.playerTwoChar = null; | ||
| CharacterSelect.playerOneChar = null; | ||
| StateManager.gameState = GameState.CHARACTERSELECT; | ||
| MapSelect.mapName = null; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseReleased(MouseEvent e) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,52 @@ | ||
| package data; | ||
|
|
||
| import java.awt.Graphics; | ||
| import java.awt.Image; | ||
|
|
||
|
|
||
| import javax.swing.ImageIcon; | ||
|
|
||
| public class MainMenu { | ||
|
|
||
| public static final int WIDTH = 900, HEIGHT = 450; //Default | ||
| public static boolean musicOn; | ||
| public static boolean sfxOn; | ||
|
|
||
| private Image menuBG; | ||
| public static AudioPlayer music; | ||
| public static AudioPlayer sfx1; | ||
| public static AudioPlayer sfx2; | ||
| private UI menuUI; | ||
| private Image play, settings, exit; | ||
| public MainMenu() | ||
| { | ||
| this.menuBG = new ImageIcon(getClass().getClassLoader().getResource("res/mainmenu.png")).getImage(); | ||
| this.play = new ImageIcon(getClass().getClassLoader().getResource("res/play.png")).getImage(); | ||
| this.settings = new ImageIcon(getClass().getClassLoader().getResource("res/settings.png")).getImage(); | ||
| this.exit = new ImageIcon(getClass().getClassLoader().getResource("res/exit.png")).getImage(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| MainMenu.sfx1 = new AudioPlayer("res/buttonEffect.wav"); | ||
| MainMenu.musicOn = true; | ||
| MainMenu.sfxOn = true; | ||
| this.menuUI = new UI(); | ||
| menuUI.addButton("Play", play, 650, 135, 167, 100); | ||
| menuUI.addButton("Settings", settings, 637, 240, 200, 100); | ||
| menuUI.addButton("Exit", exit, 650, 345, 167, 100); | ||
| if(MainMenu.musicOn == true) | ||
| music.play(); | ||
| if(MainMenu.sfxOn == true) | ||
| sfx1.play(); | ||
| } | ||
|
|
||
| private void updateButtons() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| public void update(Graphics g) | ||
| { | ||
| g.drawImage(menuBG, 0, 0, WIDTH, HEIGHT, null); | ||
| menuUI.draw(g); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,69 @@ | ||
| package data; | ||
|
|
||
| import java.awt.Graphics; | ||
| import java.awt.Image; | ||
| import java.awt.MouseInfo; | ||
|
|
||
| import javax.swing.ImageIcon; | ||
|
|
||
| public class MainMenu { | ||
|
|
||
| public static final int WIDTH = 900, HEIGHT = 450; //Default | ||
| public static boolean musicOn; | ||
| public static boolean sfxOn; | ||
|
|
||
| private Image menuBG; | ||
| public static AudioPlayer music; | ||
| public static AudioPlayer sfx1; | ||
| public static AudioPlayer sfx2; | ||
| private UI menuUI; | ||
| private Image play, settings, exit; | ||
| public MainMenu() | ||
| { | ||
| this.menuBG = new ImageIcon(getClass().getClassLoader().getResource("res/mainmenu.png")).getImage(); | ||
| this.play = new ImageIcon(getClass().getClassLoader().getResource("res/play.png")).getImage(); | ||
| this.settings = new ImageIcon(getClass().getClassLoader().getResource("res/settings.png")).getImage(); | ||
| this.exit = new ImageIcon(getClass().getClassLoader().getResource("res/exit.png")).getImage(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| MainMenu.sfx1 = new AudioPlayer("res/buttonEffect.wav"); | ||
| MainMenu.musicOn = true; | ||
| MainMenu.sfxOn = true; | ||
| this.menuUI = new UI(); | ||
| menuUI.addButton("Play", play, 650, 135, 167, 100); | ||
| menuUI.addButton("Settings", settings, 637, 240, 200, 100); | ||
| menuUI.addButton("Exit", exit, 650, 345, 167, 100); | ||
| if(MainMenu.musicOn == true) | ||
| music.play(); | ||
| if(MainMenu.sfxOn == true){ | ||
| int mx = (int) MouseInfo.getPointerInfo().getLocation().getX(); | ||
| int my = (int) MouseInfo.getPointerInfo().getLocation().getY(); | ||
| //Play | ||
| if(mx>650 && mx<(650+167) && my>135 && my<(135+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private void updateButtons() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| public void update(Graphics g) | ||
| { | ||
| g.drawImage(menuBG, 0, 0, WIDTH, HEIGHT, null); | ||
| menuUI.draw(g); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,38 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseMotionListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseMotionInput implements MouseMotionListener{ | ||
|
|
||
| @Override | ||
| public void mouseDragged(MouseEvent arg0) { | ||
| // TODO Auto-generated method stub | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseMoved(MouseEvent e) { | ||
| int mx = e.getX(); | ||
| int my = e.getY(); | ||
| if(StateManager.gameState == GameState.MAINMENU) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| System.out.print("yee"); | ||
| } | ||
| //Settings | ||
| if(mx>637 && mx<(637+200) && my>240 && my<(240+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
| //Exit | ||
| if(mx>650 && mx<(650+167) && my>345 && my<(345+100)) | ||
| { | ||
| MainMenu.sfx1.play(); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,52 @@ | ||
| package data; | ||
|
|
||
| import java.awt.Graphics; | ||
| import java.awt.Image; | ||
| import java.awt.event.MouseEvent; | ||
|
|
||
| import javax.swing.ImageIcon; | ||
|
|
||
| public class MainMenu { | ||
|
|
||
| public static final int WIDTH = 900, HEIGHT = 450; //Default | ||
| public static boolean musicOn; | ||
| public static boolean sfxOn; | ||
|
|
||
| private Image menuBG; | ||
| public static AudioPlayer music; | ||
| public static AudioPlayer sfx1; | ||
| public static AudioPlayer sfx2; | ||
| private UI menuUI; | ||
| private Image play, settings, exit; | ||
| public MainMenu() | ||
| { | ||
| this.menuBG = new ImageIcon(getClass().getClassLoader().getResource("res/mainmenu.png")).getImage(); | ||
| this.play = new ImageIcon(getClass().getClassLoader().getResource("res/play.png")).getImage(); | ||
| this.settings = new ImageIcon(getClass().getClassLoader().getResource("res/settings.png")).getImage(); | ||
| this.exit = new ImageIcon(getClass().getClassLoader().getResource("res/exit.png")).getImage(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| MainMenu.sfx1 = new AudioPlayer("res/buttonEffect.wav"); | ||
| MainMenu.musicOn = true; | ||
| MainMenu.sfxOn = true; | ||
| this.menuUI = new UI(); | ||
| menuUI.addButton("Play", play, 650, 135, 167, 100); | ||
| menuUI.addButton("Settings", settings, 637, 240, 200, 100); | ||
| menuUI.addButton("Exit", exit, 650, 345, 167, 100); | ||
| if(MainMenu.musicOn == true) | ||
| music.play(); | ||
| //if(MainMenu.sfxOn == true) | ||
| //MouseInput.nice(MouseEvent e); | ||
| } | ||
|
|
||
| private void updateButtons() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| public void update(Graphics g) | ||
| { | ||
| g.drawImage(menuBG, 0, 0, WIDTH, HEIGHT, null); | ||
| menuUI.draw(g); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,52 @@ | ||
| package data; | ||
|
|
||
| import java.awt.Graphics; | ||
| import java.awt.Image; | ||
|
|
||
|
|
||
| import javax.swing.ImageIcon; | ||
|
|
||
| public class MainMenu { | ||
|
|
||
| public static final int WIDTH = 900, HEIGHT = 450; //Default | ||
| public static boolean musicOn; | ||
| public static boolean sfxOn; | ||
|
|
||
| private Image menuBG; | ||
| public static AudioPlayer music; | ||
| public static AudioPlayer sfx1; | ||
| public static AudioPlayer sfx2; | ||
| private UI menuUI; | ||
| private Image play, settings, exit; | ||
| public MainMenu() | ||
| { | ||
| this.menuBG = new ImageIcon(getClass().getClassLoader().getResource("res/mainmenu.png")).getImage(); | ||
| this.play = new ImageIcon(getClass().getClassLoader().getResource("res/play.png")).getImage(); | ||
| this.settings = new ImageIcon(getClass().getClassLoader().getResource("res/settings.png")).getImage(); | ||
| this.exit = new ImageIcon(getClass().getClassLoader().getResource("res/exit.png")).getImage(); | ||
| MainMenu.music = new AudioPlayer("res/sciFi.wav"); | ||
| MainMenu.sfx1 = new AudioPlayer("res/buttonEffect.wav"); | ||
| MainMenu.musicOn = true; | ||
| MainMenu.sfxOn = true; | ||
| this.menuUI = new UI(); | ||
| menuUI.addButton("Play", play, 650, 135, 167, 100); | ||
| menuUI.addButton("Settings", settings, 637, 240, 200, 100); | ||
| menuUI.addButton("Exit", exit, 650, 345, 167, 100); | ||
| if(MainMenu.musicOn == true) | ||
| music.play(); | ||
| if(MainMenu.sfxOn == true) | ||
| return; | ||
| } | ||
|
|
||
| private void updateButtons() | ||
| { | ||
|
|
||
| } | ||
|
|
||
| public void update(Graphics g) | ||
| { | ||
| g.drawImage(menuBG, 0, 0, WIDTH, HEIGHT, null); | ||
| menuUI.draw(g); | ||
| } | ||
|
|
||
| } |
| @@ -1,16 +1,17 @@ | ||
| INDEX VERSION 1.127+H:\11th Grade\Computer Systems Research\workspace\.metadata\.plugins\org.eclipse.jdt.core | ||
| 4155206848.index | ||
| 3626448167.index | ||
| 163172794.index | ||
| 4041092966.index | ||
| 30765161.index | ||
| 4173023868.index | ||
| 1995173708.index | ||
| 305854171.index | ||
| 3974580528.index | ||
| 3133528496.index | ||
| 1498219845.index | ||
| 3065916431.index | ||
| 4108727661.index | ||
| 1697886153.index | ||
| 1818563445.index | ||
| 1115467115.index |
| @@ -1,3 +1,3 @@ | ||
| #Fri Jun 03 13:29:10 EDT 2016 | ||
| org.eclipse.core.runtime=2 | ||
| org.eclipse.platform=4.5.2.v20160128-1800 |
| @@ -0,0 +1,21 @@ | ||
| package data; | ||
|
|
||
| import java.awt.event.MouseEvent; | ||
| import java.awt.event.MouseMotionListener; | ||
|
|
||
| import data.StateManager.GameState; | ||
|
|
||
| public class MouseMotionInput implements MouseMotionListener{ | ||
|
|
||
| @Override | ||
| public void mouseDragged(MouseEvent arg0) { | ||
|
|
||
| } | ||
|
|
||
| @Override | ||
| public void mouseMoved(MouseEvent e) { | ||
|
|
||
|
|
||
| } | ||
|
|
||
| } |