Skip to content

Commit

Permalink
Merge pull request #49 from Adrian400811/Jimmy
Browse files Browse the repository at this point in the history
Changes for EndScreen and GameOverScreen
  • Loading branch information
349928465 authored Jun 13, 2024
2 parents dbb2481 + 57ae560 commit 8235cab
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 124 deletions.
47 changes: 47 additions & 0 deletions EndScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,18 @@
*/
public class EndScreen extends World
{
private final Font font = new Font("Arial", 64);
private final SuperDisplayLabel titleLabel = new SuperDisplayLabel(Color.WHITE, Color.BLACK, font);
private final GreenfootImage titleImage = new GreenfootImage("youWin.png");

private final SuperDisplayLabel gameOverLabel = new SuperDisplayLabel(font);
private final GreenfootImage gameOverImage = new GreenfootImage("gameOverInstructions.png");

private Crown crown = new Crown();

private GreenfootImage playerImage = new GreenfootImage("GuyR0.png");
private Button player = new Button();

/**
* Constructor for objects of class EndScreen.
*
Expand All @@ -17,8 +28,44 @@ public EndScreen()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1280, 720, 1);


// Paint Order
setPaintOrder(SuperDisplayLabel.class, Crown.class, Button.class);

// Background
setBackground("brick.jpg");

// Title
addObject(titleLabel, 600, 200);
titleLabel.setImage(titleImage);
titleLabel.setLocation(640, 150);

// Instruction Label
addObject(gameOverLabel, getWidth() / 2, 600);
gameOverLabel.update("Press 'enter' to go to the Title Screen");
gameOverImage.scale(1100, 60);
gameOverLabel.setImage(gameOverImage);
gameOverLabel.setLocation(getWidth() / 2, 600);

// Add a Crown
addObject(crown, getWidth()/2-5, getHeight()/2-78);

// Add player
playerImage.scale(140,150);
player.setImage(playerImage);
addObject(player, getWidth()/2, getHeight()/2);

}

public void act() {
checkKeys();
}

private void checkKeys() {
if (Greenfoot.isKeyDown("enter")) {
TitleScreen title = new TitleScreen();
Greenfoot.setWorld(title);
}
}
}
9 changes: 8 additions & 1 deletion GameOverScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ public class GameOverScreen extends World {
private final SuperDisplayLabel gameOverLabel = new SuperDisplayLabel(font);
private final GreenfootImage gameOverImage = new GreenfootImage("gameOverInstructions.png");

private GreenfootImage playerImage = new GreenfootImage("GuyDeath.png");
private Button player = new Button();

/**
* Constructor for objects of class GameOverScreen.
*/
Expand All @@ -36,7 +39,11 @@ public GameOverScreen() {
gameOverLabel.setImage(gameOverImage);
gameOverLabel.setLocation(getWidth() / 2, 600);


//Add player
playerImage.scale(140,150);
player.setImage(playerImage);
addObject(player, getWidth()/2, getHeight()/2);

}

public void act() {
Expand Down
Binary file added images/GuyDeath.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/youWin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8235cab

Please sign in to comment.