Skip to content

Commit 2d1f5b8

Browse files
committed
Disabled quick map switch
1 parent 39567c0 commit 2d1f5b8

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

src/com/redomar/game/Game.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,22 @@ public void render() {
214214
}
215215
}
216216

217-
if (input.PlayMusic == true && notActive == true){
217+
if (input.isPlayMusic() == true && notActive == true){
218218
int musicOption = JOptionPane.showConfirmDialog(this, "You are about to turn on music and can be VERY loud", "Music Options", 2, 2);
219219
if (musicOption == 0){
220220
musicThread.start();
221221
notActive = false;
222222
} else {
223223
System.out.println("Canceled");
224-
input.PlayMusic = false;
224+
input.setPlayMusic(false);
225225
}
226226
}
227227

228+
if (input.isChangeLevel() == true){
229+
JOptionPane.showMessageDialog(this, "Switching Levels is currently disabled");
230+
input.setChangeLevel(false);
231+
}
232+
228233
Graphics g = bs.getDrawGraphics();
229234

230235
g.drawRect(0, 0, getWidth(), getHeight());

src/com/redomar/game/InputHandler.java

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public void toggle(boolean isPressed) {
3434
public Key left = new Key();
3535
public Key right = new Key();
3636
public Key Z = new Key();
37-
public boolean PlayMusic = false;
37+
private boolean PlayMusic = false;
38+
private boolean ChangeLevel = false;
3839
private int map;
3940

4041
public void keyPressed(KeyEvent e) {
@@ -63,17 +64,42 @@ public void toggleKey(int keyCode, boolean isPressed) {
6364
right.toggle(isPressed);
6465
}
6566
if (keyCode == KeyEvent.VK_M){
66-
this.PlayMusic = true;
67+
this.setPlayMusic(true);
6768
}
6869
if (keyCode == KeyEvent.VK_Z){
69-
if (map == 0){
70-
Game.getGame().setMap("/levels/water_level.png");
71-
map++;
72-
} else{
73-
Game.getGame().setMap("/levels/custom_level.png");
74-
map--;
75-
}
70+
// if (map == 0){
71+
// Game.getGame().setMap("/levels/water_level.png");
72+
// map++;
73+
// } else{
74+
// Game.getGame().setMap("/levels/custom_level.png");
75+
// map--;
76+
// }
77+
this.setChangeLevel(true);
7678
}
7779
}
7880

81+
public int getMap() {
82+
return map;
83+
}
84+
85+
public void setMap(int map) {
86+
this.map = map;
87+
}
88+
89+
public boolean isPlayMusic() {
90+
return PlayMusic;
91+
}
92+
93+
public void setPlayMusic(boolean playMusic) {
94+
PlayMusic = playMusic;
95+
}
96+
97+
public boolean isChangeLevel() {
98+
return ChangeLevel;
99+
}
100+
101+
public void setChangeLevel(boolean changeLevel) {
102+
ChangeLevel = changeLevel;
103+
}
104+
79105
}

0 commit comments

Comments
 (0)