diff --git a/Bomb.class b/Bomb.class new file mode 100644 index 0000000..103cec5 Binary files /dev/null and b/Bomb.class differ diff --git a/Bomb.ctxt b/Bomb.ctxt new file mode 100644 index 0000000..6f947c5 --- /dev/null +++ b/Bomb.ctxt @@ -0,0 +1,5 @@ +#BlueJ class context +comment0.target=Bomb +comment1.params= +comment1.target=void\ act() +numComments=2 diff --git a/Bomb.java b/Bomb.java new file mode 100644 index 0000000..bd7e3fe --- /dev/null +++ b/Bomb.java @@ -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); + } + } + } + diff --git a/Boss.class b/Boss.class new file mode 100644 index 0000000..76fc4a7 Binary files /dev/null and b/Boss.class differ diff --git a/Boss.ctxt b/Boss.ctxt new file mode 100644 index 0000000..c8f856b --- /dev/null +++ b/Boss.ctxt @@ -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 diff --git a/Boss.java b/Boss.java new file mode 100644 index 0000000..ade05e0 --- /dev/null +++ b/Boss.java @@ -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()); + } + } + } \ No newline at end of file diff --git a/BossProjectile.class b/BossProjectile.class new file mode 100644 index 0000000..ef503f3 Binary files /dev/null and b/BossProjectile.class differ diff --git a/BossProjectile.ctxt b/BossProjectile.ctxt new file mode 100644 index 0000000..5e0c737 --- /dev/null +++ b/BossProjectile.ctxt @@ -0,0 +1,5 @@ +#BlueJ class context +comment0.target=BossProjectile +comment1.params= +comment1.target=void\ act() +numComments=2 diff --git a/BossProjectile.java b/BossProjectile.java new file mode 100644 index 0000000..33513ae --- /dev/null +++ b/BossProjectile.java @@ -0,0 +1,14 @@ +import greenfoot.*; + +public class BossProjectile extends EnemyProjectile +{ + + public void act() + { + if(isAtEdge()) { + getWorld().removeObject(this); + } else { + move(10); + } + } +} diff --git a/Box.class b/Box.class new file mode 100644 index 0000000..632e46b Binary files /dev/null and b/Box.class differ diff --git a/Box.ctxt b/Box.ctxt new file mode 100644 index 0000000..db25690 --- /dev/null +++ b/Box.ctxt @@ -0,0 +1,5 @@ +#BlueJ class context +comment0.target=Box +comment1.params= +comment1.target=void\ act() +numComments=2 diff --git a/Box.java b/Box.java new file mode 100644 index 0000000..2b7abd5 --- /dev/null +++ b/Box.java @@ -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); + } + } + +} \ No newline at end of file diff --git a/Dead.class b/Dead.class new file mode 100644 index 0000000..91e4fc9 Binary files /dev/null and b/Dead.class differ diff --git a/Dead.ctxt b/Dead.ctxt new file mode 100644 index 0000000..431b36b --- /dev/null +++ b/Dead.ctxt @@ -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 diff --git a/Dead.java b/Dead.java new file mode 100644 index 0000000..c0e7d48 --- /dev/null +++ b/Dead.java @@ -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"); + } +} diff --git a/Enemy.class b/Enemy.class new file mode 100644 index 0000000..066d9dd Binary files /dev/null and b/Enemy.class differ diff --git a/Enemy.ctxt b/Enemy.ctxt new file mode 100644 index 0000000..1b82cf2 --- /dev/null +++ b/Enemy.ctxt @@ -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 diff --git a/Enemy.java b/Enemy.java new file mode 100644 index 0000000..8450383 --- /dev/null +++ b/Enemy.java @@ -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; + } +} \ No newline at end of file diff --git a/EnemyProjectile.class b/EnemyProjectile.class new file mode 100644 index 0000000..f28c471 Binary files /dev/null and b/EnemyProjectile.class differ diff --git a/EnemyProjectile.ctxt b/EnemyProjectile.ctxt new file mode 100644 index 0000000..fc98da1 --- /dev/null +++ b/EnemyProjectile.ctxt @@ -0,0 +1,5 @@ +#BlueJ class context +comment0.target=EnemyProjectile +comment1.params= +comment1.target=EnemyProjectile() +numComments=2 diff --git a/EnemyProjectile.java b/EnemyProjectile.java new file mode 100644 index 0000000..a3dd2e7 --- /dev/null +++ b/EnemyProjectile.java @@ -0,0 +1,8 @@ +import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot und MouseInfo) + +public class EnemyProjectile extends Projectile +{ + EnemyProjectile() { + turn(180); + } +} \ No newline at end of file diff --git a/HealthAnimation.class b/HealthAnimation.class new file mode 100644 index 0000000..831d9b5 Binary files /dev/null and b/HealthAnimation.class differ diff --git a/HealthAnimation.ctxt b/HealthAnimation.ctxt new file mode 100644 index 0000000..525f9ae --- /dev/null +++ b/HealthAnimation.ctxt @@ -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 diff --git a/HealthAnimation.java b/HealthAnimation.java new file mode 100644 index 0000000..7d4efcc --- /dev/null +++ b/HealthAnimation.java @@ -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); + } + } +} \ No newline at end of file diff --git a/Moon.class b/Moon.class new file mode 100644 index 0000000..9df4ecc Binary files /dev/null and b/Moon.class differ