Skip to content

Commit

Permalink
Added some text to EndScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
349928465 committed Jun 13, 2024
1 parent 6c509fc commit 7e5a0b2
Show file tree
Hide file tree
Showing 3 changed files with 182 additions and 79 deletions.
34 changes: 34 additions & 0 deletions EndScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
*/
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();
/**
* Constructor for objects of class EndScreen.
*
Expand All @@ -20,5 +27,32 @@ public EndScreen()

// 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, getHeight()/2);

}

public void act() {
checkKeys();
}

private void checkKeys() {
if (Greenfoot.isKeyDown("enter")) {
TitleScreen title = new TitleScreen();
Greenfoot.setWorld(title);
}
}
}
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 7e5a0b2

Please sign in to comment.