Skip to content

Commit

Permalink
Clean up code and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
reihoron committed Jun 14, 2024
1 parent 1b3cc85 commit c6e21b7
Show file tree
Hide file tree
Showing 50 changed files with 533 additions and 588 deletions.
7 changes: 4 additions & 3 deletions BlueBee.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

/**
* BlueBee Class
*
*
* @author Adrian, Jason
* @version June 13 2024
*/
public class BlueBee extends Bee {
private final int speed;
private final int range;
private final int direction;
private World w;
private Level w;
private int[] anchor;

public BlueBee() {
Expand All @@ -21,12 +21,13 @@ public BlueBee() {
}

public void addedToWorld(World w) {
this.w = (Level) w;
super.addedToWorld(w);
anchor = new int[]{getX(), getY()};
}

public void act() {

movement();
collision();
super.act();
Expand Down
5 changes: 2 additions & 3 deletions Coin.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
* @version June 13 2024
*/
public class Coin extends Collection {
private final GreenfootImage image;

/**
* Constructor
*/
public Coin() {
image = new GreenfootImage("coin.png");
image.scale(45,45);
GreenfootImage image = new GreenfootImage("coin.png");
image.scale(45, 45);
setImage(image);

}
Expand Down
5 changes: 2 additions & 3 deletions Crown.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
* @version June 13 2024
*/
public class Crown extends Collection {
private final GreenfootImage image;

/**
* Constructor
*/
public Crown() {
image = new GreenfootImage("crown.png");
GreenfootImage image = new GreenfootImage("crown.png");
image.scale(64, 64);
setImage(image);
}
Expand All @@ -22,7 +21,7 @@ public Crown() {
* Act - Removes from world if touching Player and adds it to totalCrowns
*/
public void act() {
if (isTouching(Player.class)){
if (isTouching(Player.class)) {
playCollected();
getWorld().removeObject(this);
Level.addCrown();
Expand Down
Empty file modified Drone.java
100644 → 100755
Empty file.
50 changes: 21 additions & 29 deletions EndScreen.java
Original file line number Diff line number Diff line change
@@ -1,63 +1,55 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import greenfoot.*;

/**
* End Screen for the game
*
*
* @author Jimmy
* @version June 13 2024
*/
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();

public class EndScreen extends World {
/**
* Constructor for objects of class EndScreen.
*
*/
public EndScreen()
{
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
Font font = new Font("Arial", 64);
SuperDisplayLabel titleLabel = new SuperDisplayLabel(Color.WHITE, Color.BLACK, font);
addObject(titleLabel, 600, 200);
GreenfootImage titleImage = new GreenfootImage("youWin.png");
titleLabel.setImage(titleImage);
titleLabel.setLocation(640, 150);

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

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

Crown crown = new Crown();
addObject(crown, getWidth() / 2 - 5, getHeight() / 2 - 78);

// Add player
playerImage.scale(140,150);
GreenfootImage playerImage = new GreenfootImage("GuyR0.png");
playerImage.scale(140, 150);
Button player = new Button();
player.setImage(playerImage);
addObject(player, getWidth()/2, getHeight()/2);
addObject(player, getWidth() / 2, getHeight() / 2);

}

public void act() {
checkKeys();
}
Expand All @@ -68,7 +60,7 @@ private void checkKeys() {
Greenfoot.setWorld(title);
}
}

public void stopped() {
TitleScreen.stopBGM();
}
Expand Down
Empty file modified ExplodingRobot.java
100644 → 100755
Empty file.
Empty file modified FriendlyCreatures.java
100644 → 100755
Empty file.
24 changes: 10 additions & 14 deletions GameOverScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
* @version June 13 2024
*/
public class GameOverScreen 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("GameOverText.png");

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 @@ -28,22 +18,28 @@ public GameOverScreen() {
setBackground("brick.jpg");

// Title
Font font = new Font("Arial", 64);
SuperDisplayLabel titleLabel = new SuperDisplayLabel(Color.WHITE, Color.BLACK, font);
addObject(titleLabel, 600, 200);
GreenfootImage titleImage = new GreenfootImage("GameOverText.png");
titleLabel.setImage(titleImage);
titleLabel.setLocation(640, 150);

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

//Add player
playerImage.scale(140,150);
GreenfootImage playerImage = new GreenfootImage("GuyDeath.png");
playerImage.scale(140, 150);
Button player = new Button();
player.setImage(playerImage);
addObject(player, getWidth()/2, getHeight()/2);

addObject(player, getWidth() / 2, getHeight() / 2);
}

public void act() {
Expand All @@ -56,7 +52,7 @@ private void checkKeys() {
Greenfoot.setWorld(title);
}
}

public void stopped() {
TitleScreen.stopBGM();
}
Expand Down
Loading

0 comments on commit c6e21b7

Please sign in to comment.