Skip to content

Commit

Permalink
Merge pull request #96 from rowan04/tidy-up-updates
Browse files Browse the repository at this point in the history
Tidy-up fixes
  • Loading branch information
rowan04 authored May 5, 2023
2 parents 9405d9e + af5dfdf commit f0e0723
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 223 deletions.
8 changes: 0 additions & 8 deletions maze-game/Again.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,4 @@ public Again() //constructor to set information on actor creation
{
setImage("button-green.png"); //sets the image of this actor
}
/**
* Act - do whatever the Again wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
12 changes: 3 additions & 9 deletions maze-game/Armed.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@
*/
public class Armed extends Actor
{
//sets image and size on creation
/**
* sets image and size on creation
*/
public Armed()
{
setImage("armed.png");
GreenfootImage armed = getImage();
armed.scale(25, 25); //sets image size
}
/**
* Act - do whatever the Armed wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
7 changes: 3 additions & 4 deletions maze-game/Beam.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,21 @@ public Beam(int dir) //on creation sets the information for this actor using
{
setImage("beam.png"); //sets the image of this actor
GreenfootImage beam = getImage();
beam.scale(25, 25); //sets the image of this actor
beam.scale(25, 25);

direction = dir; //player input
speed = 15; //speed defined here so can be easily changed if decided we don't want that speed
}

/**
* Act - do whatever the Beam wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
* This method is called when program is ran.
*/
public void act()
{
setRotation(direction); //rotates the beam based on the players input
move(speed); //the beam then moves along that line

//checks if hit an obstical
//checks if hit an obstacle
if (isTouching(Wall1.class))
{
getWorld().removeObject(this); //if touched a wall then the actor deletes itself
Expand Down
9 changes: 0 additions & 9 deletions maze-game/Breakable.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,4 @@ public Breakable() //constructor to resize breakable wall to be a better fit f
GreenfootImage crackedWall = getImage();
crackedWall.scale(50, 50); //sets the image size of this actor
}

/**
* Act - do whatever the Breakable wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
8 changes: 0 additions & 8 deletions maze-game/Breaker_icon.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,4 @@ public Breaker_icon() // constructor to resize breaker icon to be a better fit
icon.scale(98, 98);
// scaled at 98 to fit on square better, so it doesn't touch edge/walls
}
/**
* Act - do whatever the Breaker_icon wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
13 changes: 8 additions & 5 deletions maze-game/End.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ public End() //constructor to resize end pad to be a better fit for the maze
}

/**
* Act - do whatever the End wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
* Called when program is run
* constantly checks if the treasure is touching it
* if it is it calls score_treasure method
*/
public void act()
{
//constantly checks if the treasure is touching it, if it is it calls score_treasure method
if (isTouching(Treasure.class))
{
score_treasure();
}
}

//if called from act method then deletes the treasure that is touching it, increases the score and enables the fancy trophy at the end
/**
* if called from act method then deletes the treasure that is touching it, increases the score and enables the fancy trophy at the end
*/
private void score_treasure()
{
Actor Treasure;
Expand All @@ -36,6 +38,7 @@ private void score_treasure()
world = getWorld();
world.removeObject(Treasure); //deletes Treasure actor

MyWorld.trophy = true; //enables skeliton trophy at the end
//enables trophy at the end
MyWorld.trophy = true;
}
}
2 changes: 1 addition & 1 deletion maze-game/Ghost2.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class Ghost2 extends Actor
{
/**
* these values keep each ghost within their set area
* these values keep the ghost within their set area
*/
public static int lower_x;
public static int upper_x;
Expand Down
9 changes: 0 additions & 9 deletions maze-game/Ghost_buster_icon.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,4 @@ public Ghost_buster_icon() //constructor to resize ghost_buster_icon to be a b
GreenfootImage zap = getImage();
zap.scale(100, 100); //sets the image size of this actor
}

/**
* Act - do whatever the ghost_buster_icon wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
9 changes: 0 additions & 9 deletions maze-game/Intro.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,4 @@ public Intro() //constructor to resize intro text to be a better fit for the m
GreenfootImage intro = getImage();
intro.scale(1150, 700); //sets image size of this actor
}

/**
* Act - do whatever the Intro wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
8 changes: 0 additions & 8 deletions maze-game/Magnet.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,4 @@ public Magnet() //constructor to set information on actor creation
GreenfootImage magnet = getImage();
magnet.scale(48, 48); //sets image size of this actor
}
/**
* Act - do whatever the Magnet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{

}
}
9 changes: 2 additions & 7 deletions maze-game/MyWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void act()
}
}

/*
/**
* resets all variables
* sets render order for actors so they appear infront of other actors so important ones are always visable
* runs methods that setup the maze
Expand Down Expand Up @@ -118,7 +118,7 @@ private void createWorld()
showText(null, 875, 675);
showText(null, 1075, 475);


// add text to show difficulty setting
showText("difficulty setting: " + difficulty_setting, 575, 900);

// add ghosts (after maze, so they show over the walls)
Expand All @@ -130,7 +130,6 @@ private void createWorld()
// add in items
addItems();


// start the timer, setting it to 0
timer = 0;
startTimer = true;
Expand Down Expand Up @@ -430,10 +429,6 @@ private void addItems()
*/
private void prepareMaze()
{
//discance from 2 midpoint = 50
//distance from wall = 25
//23 blocks wide
//16 blocks high
create_start();
create_end();
create_walls();
Expand Down
Loading

0 comments on commit f0e0723

Please sign in to comment.