-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
100 changed files
with
1,031 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.target=Bomb | ||
comment1.params= | ||
comment1.target=void\ act() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import greenfoot.*; | ||
|
||
|
||
public class Bomb extends Actor | ||
{ | ||
int a =0; | ||
public void act() | ||
{ | ||
if (getY()<785) { | ||
setLocation(getX(), getY() +2); | ||
} | ||
a++; | ||
if (a>=300) { | ||
getWorld().removeObject(this); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#BlueJ class context | ||
comment0.target=Boss | ||
comment1.params= | ||
comment1.target=void\ act() | ||
comment2.params= | ||
comment2.target=void\ move() | ||
comment3.params= | ||
comment3.target=void\ shoot() | ||
comment4.params= | ||
comment4.target=void\ dying() | ||
numComments=5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import greenfoot.*; | ||
|
||
public class Boss extends Actor | ||
{ | ||
int a = 0; | ||
int b = Player.diff; | ||
int livesBoss = 3; | ||
GreenfootSound dead = new GreenfootSound("sfx22.wav"); | ||
GreenfootSound shootSound = new GreenfootSound("sfx3.wav"); | ||
|
||
public void act() | ||
{ | ||
move(); | ||
shoot(); | ||
dying(); | ||
} | ||
|
||
void move() | ||
{ | ||
a += b; | ||
setLocation(getX() + b, a * a / 100 + 30); | ||
|
||
if (a >= 200) { | ||
b *= -1; | ||
} | ||
|
||
if (a<=-200) { | ||
b *= -1; | ||
} | ||
} | ||
|
||
void shoot() | ||
{ | ||
if (getWorld().getObjects(BossProjectile.class).size() == 0) { | ||
shootSound.play(); | ||
getWorld().addObject(new BossProjectile(), getX(), getY() + 4); | ||
|
||
if (Greenfoot.getRandomNumber(5) == 1) { | ||
getWorld().addObject(new BossProjectile(), getX() - 10, getY() + 4); | ||
getWorld().addObject(new BossProjectile(), getX() + 10, getY() + 4); | ||
|
||
if (Greenfoot.getRandomNumber(5) == 1) { | ||
getWorld().addObject(new BossProjectile(), getX() - 20, getY() + 4); | ||
getWorld().addObject(new BossProjectile(), getX() + 20, getY() + 4); | ||
} | ||
} | ||
} | ||
} | ||
|
||
void dying() | ||
{ | ||
if (isTouching(PlayerProjectile.class)) { | ||
livesBoss -= 1; | ||
getWorld(); | ||
getWorld().removeObject(getOneIntersectingObject(PlayerProjectile.class)); | ||
} | ||
|
||
if (livesBoss == 0) { | ||
dead.play(); | ||
getWorld().removeObject(this); | ||
Player.diff++; | ||
Greenfoot.delay(150); | ||
Greenfoot.setWorld(new Space()); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.target=BossProjectile | ||
comment1.params= | ||
comment1.target=void\ act() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import greenfoot.*; | ||
|
||
public class BossProjectile extends EnemyProjectile | ||
{ | ||
public void act() | ||
{ | ||
if (isAtEdge()) { | ||
getWorld().removeObject(this); | ||
} else { | ||
move(10); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.target=Box | ||
comment1.params= | ||
comment1.target=void\ act() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import greenfoot.*; | ||
public class Box extends Actor | ||
{ | ||
int leben = 5; | ||
|
||
public void act() | ||
{ | ||
if (isTouching(Projectile.class)) { | ||
getWorld().removeObject(getOneIntersectingObject(Projectile.class)); | ||
leben--; | ||
setImage("box"+leben+".png"); | ||
} | ||
|
||
if (leben==0) { | ||
getWorld().removeObject(this); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.target=Dead | ||
comment1.params= | ||
comment1.target=Dead() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import greenfoot.*; | ||
|
||
public class Dead extends World | ||
{ | ||
public Dead() | ||
{ | ||
super(600, 800, 1); | ||
setBackground("dead.png"); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#BlueJ class context | ||
comment0.target=Enemy | ||
comment1.params= | ||
comment1.target=void\ act() | ||
comment2.params= | ||
comment2.target=void\ shoot() | ||
comment3.params= | ||
comment3.target=int\ getLives() | ||
numComments=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import greenfoot.*; | ||
import java.util.ArrayList; | ||
|
||
public class Enemy extends Actor | ||
{ | ||
private int lives = 1; | ||
private Space space; | ||
GreenfootSound deadE = new GreenfootSound("sfx3.wav"); | ||
GreenfootSound shootSound = new GreenfootSound("sfx3.wav"); | ||
|
||
public void act() | ||
{ | ||
if (isTouching(PlayerProjectile.class)) { | ||
lives--; | ||
getWorld().removeObject(getOneIntersectingObject(PlayerProjectile.class)); | ||
} | ||
|
||
if (lives == 0) { | ||
((Space)getWorld()).getPlayer().setScore(10); | ||
deadE.play(); | ||
} | ||
} | ||
|
||
public void shoot() | ||
{ | ||
try { | ||
if (getWorld().getObjects(EnemyProjectile.class).size() == 0) { | ||
getWorld().addObject(new EnemyProjectile(), getX(), getY() + 4); | ||
shootSound.play(); | ||
} | ||
} catch (Exception e) {} | ||
} | ||
|
||
public int getLives() | ||
{ | ||
return lives; | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.target=EnemyProjectile | ||
comment1.params= | ||
comment1.target=EnemyProjectile() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import greenfoot.*; | ||
|
||
public class EnemyProjectile extends Projectile | ||
{ | ||
EnemyProjectile() | ||
{ | ||
turn(180); | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#BlueJ class context | ||
comment0.target=HealthAnimation | ||
comment1.params=s | ||
comment1.target=HealthAnimation(boolean) | ||
comment2.params= | ||
comment2.target=void\ act() | ||
numComments=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import greenfoot.*; | ||
|
||
public class HealthAnimation extends Actor | ||
{ | ||
public boolean state; | ||
private int count = 8; | ||
|
||
public HealthAnimation(boolean s) | ||
{ | ||
state = s; | ||
|
||
if (state) { | ||
setImage("+1.png"); | ||
} else { | ||
setImage("-1.png"); | ||
} | ||
} | ||
|
||
public void act() | ||
{ | ||
if (count > 0) { | ||
setLocation(getX(), getY() - count); | ||
count--; | ||
} else { | ||
getWorld().removeObject(this); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#BlueJ class context | ||
comment0.target=Moon | ||
comment1.params= | ||
comment1.target=void\ act() | ||
numComments=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import greenfoot.*; | ||
|
||
public class Moon extends Actor | ||
{ | ||
int a = 3; | ||
public void act() | ||
{ | ||
setLocation(getX() + a, getY()); | ||
|
||
if (isAtEdge()) { | ||
a *= -1; | ||
setLocation(getX() - a * 5, getY()); | ||
} | ||
|
||
if (isTouching(PlayerProjectile.class)) { | ||
getWorld().removeObject(getOneIntersectingObject(PlayerProjectile.class)); | ||
getWorld().addObject(new Bomb(), getX(), getY() + 4); | ||
} | ||
|
||
if (Greenfoot.getRandomNumber(500)==1) { | ||
getWorld().addObject(new Bomb(), getX(), getY() + 4); | ||
|
||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#BlueJ class context | ||
comment0.target=Player | ||
comment1.params= | ||
comment1.target=void\ Player() | ||
comment10.params=i | ||
comment10.target=void\ setPower(int) | ||
comment11.params= | ||
comment11.target=int\ getPower() | ||
comment12.params= | ||
comment12.target=int\ getDiff() | ||
comment13.params= | ||
comment13.target=void\ setDiff() | ||
comment2.params= | ||
comment2.target=void\ act() | ||
comment3.params= | ||
comment3.target=void\ move() | ||
comment4.params= | ||
comment4.target=void\ shoot() | ||
comment5.params= | ||
comment5.target=void\ dying() | ||
comment6.params= | ||
comment6.target=void\ bePower() | ||
comment7.params= | ||
comment7.target=int\ getScore() | ||
comment8.params=s | ||
comment8.target=void\ setScore(int) | ||
comment9.params= | ||
comment9.target=int\ getLifes() | ||
numComments=14 |
Oops, something went wrong.