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 21, 2022
1 parent de4553d commit 0aa5958
Show file tree
Hide file tree
Showing 100 changed files with 1,031 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
17 changes: 17 additions & 0 deletions Bomb.java
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 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
{
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 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
13 changes: 13 additions & 0 deletions BossProjectile.java
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);
}
}
}
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
18 changes: 18 additions & 0 deletions Box.java
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 added Dead.class
Binary file not shown.
5 changes: 5 additions & 0 deletions Dead.ctxt
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
10 changes: 10 additions & 0 deletions Dead.java
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 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
38 changes: 38 additions & 0 deletions Enemy.java
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 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
9 changes: 9 additions & 0 deletions EnemyProjectile.java
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 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
28 changes: 28 additions & 0 deletions HealthAnimation.java
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 added Moon.class
Binary file not shown.
5 changes: 5 additions & 0 deletions Moon.ctxt
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
25 changes: 25 additions & 0 deletions Moon.java
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 added Player.class
Binary file not shown.
29 changes: 29 additions & 0 deletions Player.ctxt
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
Loading

0 comments on commit 0aa5958

Please sign in to comment.