Skip to content

Commit

Permalink
Finished Level 0
Browse files Browse the repository at this point in the history
  • Loading branch information
reihoron committed Jun 13, 2024
1 parent 18427bb commit ce7d8c1
Show file tree
Hide file tree
Showing 54 changed files with 99 additions and 18 deletions.
18 changes: 11 additions & 7 deletions Brick.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import greenfoot.GreenfootImage;

/**
* Write a description of class Block here.
*
* @author (your name)
*
* @author (your name)
* @version (a version number or a date)
*/
public class Brick extends Tile
{
public class Brick extends Tile {
public Brick() {
GreenfootImage image = new GreenfootImage("brick.jpg");
image.scale(64, 64);
setImage(image);
}

/**
* Act - do whatever the Block wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
public void act() {
}
}
19 changes: 19 additions & 0 deletions FloorHole.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import greenfoot.Actor;
import greenfoot.GreenfootImage;
import greenfoot.World;

import java.util.List;

public class FloorHole extends Actor {
public FloorHole() {
GreenfootImage image = new GreenfootImage(1, 1);
setImage(image);
}

public void addedToWorld(World w) {
List<Brick> brick = getObjectsInRange(32, Brick.class);
for (Brick b : brick) {
w.removeObject(b);
}
}
}
Empty file modified JumpBooster.java
100644 → 100755
Empty file.
7 changes: 3 additions & 4 deletions Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ public static void addCrown() {
}

public void spawnFloor(ImgScroll sc) {
for (int j = 0; j < sc.getScrollHeight() - 100; j += 300) {
for (int i = 0; i < sc.getScrollWidth() + 64; i += 63) {
addObject(new Brick(), i, 700);
}
for (int i = 0; i < sc.getScrollWidth() + 64; i += 64) {
addObject(new Brick(), i, 700);
}
}

Expand Down Expand Up @@ -119,6 +117,7 @@ public void spawnTerrain(int[][] identifier) {
case 8 -> new Spider();
case 9 -> new Crown();
case 10 -> new JumpBooster();
case 11 -> new FloorHole();
default -> null;
};
if (a != null) {
Expand Down
Empty file modified LoadSettings.java
100644 → 100755
Empty file.
12 changes: 9 additions & 3 deletions Mobs.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public Mobs() {
public void addedToWorld(World w) {
this.w = w;
}
public void act(){

public void act() {
stepped();
}

Expand Down Expand Up @@ -110,11 +111,16 @@ public Player getPlayer(int range) {
}
return null;
}
public void stepped(){
if(getOneObjectAtOffset(getX(), -(getImage().getHeight()/2), Player.class)!=null){

public void stepped() {
if (getWorld() == null) {
return;
}
if (getOneObjectAtOffset(getX(), -(getImage().getHeight() / 2), Player.class) != null) {
getWorld().removeObject(this);
}
}

public void attack(int dmg) {
Player p = (Player) getOneIntersectingObject(Player.class);
if (p == null) {
Expand Down
10 changes: 7 additions & 3 deletions Spider.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void addedToWorld(World w) {
}

public void act() {
if (checkBlock()) {
if (checkBlock() || checkY()) {
holdAct--;
hold();
} else {
Expand Down Expand Up @@ -61,15 +61,19 @@ private boolean checkBlock() {
return getOneIntersectingObject(Tile.class) != null;
}

private boolean checkY() {
return (getY() < 0 || getY() > w.getHeight());
}

public void timeout() {
if (w == null) {
return;
}
if (!oob && (getX() < 0 || getX() > w.getWidth() || getY() < 0 || getY() > w.getHeight())) {
if (!oob && (getX() < 0)) {
oob = true;
startTime = System.currentTimeMillis();
}
if (oob && !(getX() < 0 || getX() > w.getWidth() || getY() < 0 || getY() > w.getHeight())) {
if (oob && !(getX() < 0)) {
oob = false;
}
if (oob) {
Expand Down
Empty file modified doc/Bee.html
100644 → 100755
Empty file.
Empty file modified doc/BlueBee.html
100644 → 100755
Empty file.
Empty file modified doc/Brick.html
100644 → 100755
Empty file.
Empty file modified doc/Button.html
100644 → 100755
Empty file.
Empty file modified doc/Coin.html
100644 → 100755
Empty file.
Empty file modified doc/Collection.html
100644 → 100755
Empty file.
Empty file modified doc/Crown.html
100644 → 100755
Empty file.
Empty file modified doc/EndScreen.html
100644 → 100755
Empty file.
Empty file modified doc/GameOverScreen.html
100644 → 100755
Empty file.
Empty file modified doc/GreenBee.html
100644 → 100755
Empty file.
Empty file modified doc/ImgScroll.html
100644 → 100755
Empty file.
Empty file modified doc/Level.html
100644 → 100755
Empty file.
Empty file modified doc/Level0.html
100644 → 100755
Empty file.
Empty file modified doc/Level1.html
100644 → 100755
Empty file.
Empty file modified doc/Mites.html
100644 → 100755
Empty file.
Empty file modified doc/Mobs.html
100644 → 100755
Empty file.
Empty file modified doc/Orb.html
100644 → 100755
Empty file.
Empty file modified doc/RedBee.html
100644 → 100755
Empty file.
Empty file modified doc/Spider.html
100644 → 100755
Empty file.
Empty file modified doc/SuperDisplayLabel.html
100644 → 100755
Empty file.
Empty file modified doc/SuperSmoothMover.html
100644 → 100755
Empty file.
Empty file modified doc/Tile.html
100644 → 100755
Empty file.
Empty file modified doc/TitleScreen.html
100644 → 100755
Empty file.
Empty file modified doc/allclasses-index.html
100644 → 100755
Empty file.
Empty file modified doc/allpackages-index.html
100644 → 100755
Empty file.
Empty file modified doc/help-doc.html
100644 → 100755
Empty file.
Empty file modified doc/index-all.html
100644 → 100755
Empty file.
Empty file modified doc/jquery-ui.overrides.css
100644 → 100755
Empty file.
Empty file modified doc/member-search-index.js
100644 → 100755
Empty file.
Empty file modified doc/module-search-index.js
100644 → 100755
Empty file.
Empty file modified doc/overview-tree.html
100644 → 100755
Empty file.
Empty file modified doc/package-search-index.js
100644 → 100755
Empty file.
Empty file modified doc/package-tree.html
100644 → 100755
Empty file.
Empty file modified doc/resources/glass.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/resources/x.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified doc/script-dir/jquery-3.6.1.min.js
100644 → 100755
Empty file.
Empty file modified doc/script-dir/jquery-ui.min.css
100644 → 100755
Empty file.
Empty file modified doc/script-dir/jquery-ui.min.js
100644 → 100755
Empty file.
Empty file modified doc/search.js
100644 → 100755
Empty file.
Empty file modified doc/stylesheet.css
100644 → 100755
Empty file.
Empty file modified doc/tag-search-index.js
100644 → 100755
Empty file.
Empty file modified doc/type-search-index.js
100644 → 100755
Empty file.
Empty file modified images/saveButtonImage.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/saveFile1.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/saveFile2.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 50 additions & 1 deletion levels/0.csv
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,53 @@
59,4,1
59,3,1
59,2,1
60,10,2
70,11,11
70,1,1
70,9,8
71,11,11
71,1,1
71,4,8
72,11,11
72,2,1
72,5,8
73,10,1
74,10,1
75,10,1
76,10,1
77,10,1
78,10,1
79,11,11
80,11,11
80,1,1
80,2,8
81,11,11
82,11,11
82,1,1
82,3,8
83,10,1
84,10,1
84,9,1
85,10,1
85,9,1
85,8,1
86,10,1
86,9,1
86,8,1
86,7,1
90,8,3
90,9,3
91,7,3
91,8,3
91,9,3
91,10,3
92,7,3
92,8,3
92,9,3
92,10,3
93,7,3
93,8,3
93,9,3
93,10,3
94,8,3
94,9,3
100,10,2
Empty file modified levels/1.csv
100644 → 100755
Empty file.

0 comments on commit ce7d8c1

Please sign in to comment.