Merge remote-tracking branch 'origin/master'
# Conflicts: # out/production/final/GamePanel.class # out/production/final/GenericSprite.classmaster
commit
7914a78522
|
@ -48,9 +48,7 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
player = new Player(GAME_WIDTH/2, GAME_HEIGHT/2, 'W', 'A', 'S', 'D', spriteArray); //create a player controlled player, set start location to middle of screen
|
||||
map.add(new Tile(1000, 700));
|
||||
map.add(new Tile(700, 600));
|
||||
player = new Player(GAME_WIDTH/2, GAME_HEIGHT/2, 'W', 'A', 'S', 'D', spriteArray); //create a player controlled player, set start location to middle of screenk
|
||||
map.add(new Tile(1000, 500));
|
||||
map.add(new Tile(700, 400));
|
||||
map.add(new Tile(1000, 300));
|
||||
|
|
|
@ -31,20 +31,21 @@ public class GenericSprite extends Rectangle{
|
|||
public void keyPressed(KeyEvent e){
|
||||
if(e.getKeyChar() == 'd'){
|
||||
rightPressed = true;
|
||||
move();
|
||||
|
||||
}
|
||||
if(e.getKeyChar() == 'a'){
|
||||
leftPressed = true;
|
||||
move();
|
||||
|
||||
}
|
||||
if(e.getKeyChar() == 'w'){
|
||||
upPressed = true;
|
||||
move();
|
||||
|
||||
}
|
||||
if(e.getKeyChar() == 's'){
|
||||
downPressed = true;
|
||||
move();
|
||||
|
||||
}
|
||||
move();
|
||||
}
|
||||
|
||||
//called from GamePanel when any key is released (no longer being pressed down)
|
||||
|
|
|
@ -14,7 +14,7 @@ public class MenuPanel extends JFrame implements ActionListener {
|
|||
this.setTitle("First");
|
||||
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
this.setSize(280, 200);
|
||||
this.setVisible(true);
|
||||
|
||||
|
||||
launchGame = new JButton("Click");
|
||||
launchGame.addActionListener(this);
|
||||
|
@ -22,6 +22,7 @@ public class MenuPanel extends JFrame implements ActionListener {
|
|||
menuContainer = getContentPane();
|
||||
menuContainer.setLayout(new FlowLayout());
|
||||
menuContainer.add(launchGame);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
public void paint(Graphics g) {
|
||||
|
|
Loading…
Reference in New Issue