Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Banik1103 authored May 22, 2022
1 parent a2a827d commit 2a1c12c
Show file tree
Hide file tree
Showing 25 changed files with 262 additions and 0 deletions.
Binary file added Bomb.class
Binary file not shown.
5 changes: 5 additions & 0 deletions Bomb.ctxt
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
18 changes: 18 additions & 0 deletions Bomb.java
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 added Boss.class
Binary file not shown.
11 changes: 11 additions & 0 deletions Boss.ctxt
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
66 changes: 66 additions & 0 deletions Boss.java
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 added BossProjectile.class
Binary file not shown.
5 changes: 5 additions & 0 deletions BossProjectile.ctxt
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
14 changes: 14 additions & 0 deletions BossProjectile.java
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);
}
}
}
Binary file added Box.class
Binary file not shown.
5 changes: 5 additions & 0 deletions Box.ctxt
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
19 changes: 19 additions & 0 deletions Box.java
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 added Dead.class
Binary file not shown.
7 changes: 7 additions & 0 deletions Dead.ctxt
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
21 changes: 21 additions & 0 deletions Dead.java
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 added Enemy.class
Binary file not shown.
9 changes: 9 additions & 0 deletions Enemy.ctxt
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
35 changes: 35 additions & 0 deletions Enemy.java
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 added EnemyProjectile.class
Binary file not shown.
5 changes: 5 additions & 0 deletions EnemyProjectile.ctxt
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
8 changes: 8 additions & 0 deletions EnemyProjectile.java
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 added HealthAnimation.class
Binary file not shown.
7 changes: 7 additions & 0 deletions HealthAnimation.ctxt
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
27 changes: 27 additions & 0 deletions HealthAnimation.java
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 added Moon.class
Binary file not shown.

0 comments on commit 2a1c12c

Please sign in to comment.