-
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
25 changed files
with
262 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,18 @@ | ||
import greenfoot.*; | ||
|
||
|
||
public class Bomb extends Actor | ||
{ | ||
int a =0; | ||
public void act() | ||
{ | ||
if(getY()<785){ | ||
setLocation(getX(), getY() +2); | ||
} | ||
a = a +1; | ||
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 | ||
{ | ||
Space s = (Space)getWorld(); | ||
int a = 0; | ||
int b = Player.diff; | ||
int lifesBoss = 3; | ||
GreenfootSound dead = new GreenfootSound("sfx22.wav"); | ||
GreenfootSound shootSound = new GreenfootSound("sfx3.wav"); | ||
|
||
public void act() | ||
{ | ||
move(); | ||
shoot(); | ||
dying(); | ||
} | ||
|
||
void move() | ||
{ | ||
a= a + b; | ||
setLocation(getX() +b, a*a/100 + 30); | ||
|
||
if(a>=200){ | ||
b = b * -1; | ||
} | ||
|
||
if(a<=-200){ | ||
b = b * -1; | ||
} | ||
} | ||
|
||
void shoot() | ||
{ | ||
if (getWorld().getObjects(BossProjectile.class).size() == 0) { | ||
shootSound.play(); | ||
getWorld().addObject(new BossProjectile(), getX(), getY() + 4); | ||
if (Greenfoot.getRandomNumber(4)== 1){ | ||
getWorld().addObject(new BossProjectile(), getX() -10, getY() + 4); | ||
getWorld().addObject(new BossProjectile(), getX() +10, getY() + 4); | ||
|
||
if (Greenfoot.getRandomNumber(4)== 1){ | ||
getWorld().addObject(new BossProjectile(), getX() -20, getY() + 4); | ||
getWorld().addObject(new BossProjectile(), getX() +20, getY() + 4); | ||
} | ||
} | ||
} | ||
} | ||
|
||
void dying() | ||
{ | ||
if(isTouching(PlayerProjectile.class)){ | ||
lifesBoss -= 1; | ||
getWorld(); | ||
getWorld().removeObject(getOneIntersectingObject(PlayerProjectile.class)); | ||
} | ||
|
||
if(lifesBoss == 0){ | ||
dead.play(); | ||
getWorld().removeObject(this); | ||
((Space)getWorld()).getPlayer().setDiff(); | ||
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,14 @@ | ||
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,19 @@ | ||
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot und MouseInfo) | ||
public class Box extends Actor | ||
{ | ||
int leben = 5; | ||
|
||
public void act(){ | ||
|
||
if(isTouching(Projectile.class)){ | ||
getWorld().removeObject(getOneIntersectingObject(Projectile.class)); | ||
leben = leben -1; | ||
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,7 @@ | ||
#BlueJ class context | ||
comment0.target=Dead | ||
comment0.text=\r\n\ Write\ a\ description\ of\ class\ Dead\ here.\r\n\ \r\n\ @author\ (your\ name)\ \r\n\ @version\ (a\ version\ number\ or\ a\ date)\r\n | ||
comment1.params= | ||
comment1.target=Dead() | ||
comment1.text=\r\n\ Constructor\ for\ objects\ of\ class\ Dead.\r\n\ \r\n | ||
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,21 @@ | ||
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) | ||
|
||
/** | ||
* Write a description of class Dead here. | ||
* | ||
* @author (your name) | ||
* @version (a version number or a date) | ||
*/ | ||
public class Dead extends World | ||
{ | ||
|
||
/** | ||
* Constructor for objects of class Dead. | ||
* | ||
*/ | ||
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,35 @@ | ||
import greenfoot.*; | ||
import java.util.ArrayList; | ||
|
||
public class Enemy extends Actor | ||
{ | ||
private int lifes = 1; | ||
GreenfootSound deadE = new GreenfootSound("sfx3.wav"); | ||
GreenfootSound shootSound = new GreenfootSound("sfx3.wav"); | ||
|
||
public void act() | ||
{ | ||
if (isTouching(PlayerProjectile.class)) { | ||
lifes -= 1; | ||
getWorld().removeObject(getOneIntersectingObject(PlayerProjectile.class)); | ||
} | ||
|
||
if (lifes == 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 lifes; | ||
} | ||
} |
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,8 @@ | ||
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot und MouseInfo) | ||
|
||
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,27 @@ | ||
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.