Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added GalaxyGame-Da-Whole-Thing/Ansicht$1.class
Binary file not shown.
Binary file added GalaxyGame-Da-Whole-Thing/Ansicht$1A.class
Binary file not shown.
Binary file added GalaxyGame-Da-Whole-Thing/Ansicht$2.class
Binary file not shown.
Binary file added GalaxyGame-Da-Whole-Thing/Ansicht.class
Binary file not shown.
35 changes: 35 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Ansicht.ctxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#BlueJ class context
comment0.target=Ansicht
comment1.params=q\ g\ ges\ r\ s
comment1.target=Ansicht(Spieler,\ java.util.ArrayList,\ java.util.ArrayList,\ Rettungsschiff,\ int)
comment10.params=
comment10.target=void\ decreaseHealth()
comment11.params=
comment11.target=void\ increaseHealth()
comment12.params=i
comment12.target=void\ setScore(int)
comment13.params=b
comment13.target=void\ setBlackBackground(int)
comment14.params=
comment14.target=void\ setNewGame()
comment15.params=b
comment15.target=void\ setShowWave(boolean)
comment16.params=i
comment16.target=void\ setWaveCounter(int)
comment2.params=datName
comment2.target=java.lang.String\ ladeDatei(java.lang.String)
comment3.params=
comment3.target=java.lang.String\ reade()
comment4.params=g
comment4.target=void\ paint(java.awt.Graphics)
comment5.params=b\ x\ y\ c\ s
comment5.target=void\ setHit(boolean,\ int,\ int,\ int,\ boolean)
comment6.params=h
comment6.target=void\ setbg(int)
comment7.params=s
comment7.target=void\ setStart(int)
comment8.params=
comment8.target=void\ ge\u00E4ndert()
comment9.params=
comment9.target=void\ increaseKills()
numComments=17
358 changes: 358 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Ansicht.java

Large diffs are not rendered by default.

Binary file added GalaxyGame-Da-Whole-Thing/Beobachter.class
Binary file not shown.
5 changes: 5 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Beobachter.ctxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#BlueJ class context
comment0.target=Beobachter
comment1.params=
comment1.target=void\ ge\u00E4ndert()
numComments=2
3 changes: 3 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Beobachter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public interface Beobachter{
void geändert();
}
Binary file added GalaxyGame-Da-Whole-Thing/Blaues_Geschoss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GalaxyGame-Da-Whole-Thing/Gegner.class
Binary file not shown.
25 changes: 25 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Gegner.ctxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#BlueJ class context
comment0.target=Gegner
comment1.params=
comment1.target=int\ getSpeedX()
comment10.params=
comment10.target=void\ stopMove()
comment11.params=
comment11.target=int\ getLength()
comment2.params=
comment2.target=int\ getSpeedY()
comment3.params=
comment3.target=int\ getX()
comment4.params=
comment4.target=int\ getY()
comment5.params=b
comment5.target=void\ anmelden(Beobachter)
comment6.params=
comment6.target=int\ getKey()
comment7.params=
comment7.target=boolean\ getShoot()
comment8.params=b
comment8.target=void\ setShoot(boolean)
comment9.params=
comment9.target=void\ move()
numComments=12
25 changes: 25 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Gegner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
public interface Gegner {
//gibt Geschwindigkeit des Gegners zurück
int getSpeedX();
int getSpeedY();
//gibt die xPosition des Gegners zurück
int getX();
//gibt die yPosition des Gegners zurück
int getY();
//meldet den Beobachter an
void anmelden(Beobachter b);
//legt die Position des Gegners fest

//gibt den Identifizierungswert zurück (welche Art des Gegners dieser ist)
int getKey();
//gibt den boolean zurück, der bestimmt, ob der Gegner schießen soll
boolean getShoot();
//stoppt jegliche Bewegung des Gegners

void setShoot(boolean b);

void move();

void stopMove();
int getLength();
}
Binary file added GalaxyGame-Da-Whole-Thing/Gegner1$1.class
Binary file not shown.
Binary file added GalaxyGame-Da-Whole-Thing/Gegner1.class
Binary file not shown.
35 changes: 35 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Gegner1.ctxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#BlueJ class context
comment0.target=Gegner1
comment1.params=x\ y
comment1.target=Gegner1(int,\ int)
comment10.params=
comment10.target=void\ tryShoot()
comment11.params=b
comment11.target=void\ setShoot(boolean)
comment12.params=
comment12.target=int\ getKey()
comment13.params=
comment13.target=boolean\ getShoot()
comment14.params=
comment14.target=void\ alleInformieren()
comment15.params=
comment15.target=void\ move()
comment16.params=
comment16.target=void\ stopMove()
comment2.params=
comment2.target=int\ getLength()
comment3.params=b
comment3.target=void\ anmelden(Beobachter)
comment4.params=
comment4.target=int\ getSpeedX()
comment5.params=
comment5.target=int\ getSpeedY()
comment6.params=
comment6.target=int\ getX()
comment7.params=
comment7.target=int\ getY()
comment8.params=
comment8.target=int\ getYPosition()
comment9.params=
comment9.target=void\ setPosition()
numComments=17
113 changes: 113 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Gegner1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class Gegner1 implements Gegner{
private int speedX, speedY, xValue, yValue, length;
private ArrayList<Beobachter> beobachter;
private int key;
private boolean shoot;
private int xRichtung, yRichtung, shot;
public Gegner1(int x, int y) {
speedX=5;
speedY=5;
xValue=x;
yValue=y;
length=64;
beobachter=new ArrayList<Beobachter>();
key=0;
}
public int getLength()
{int a=0;
return a;}// random shit
public void anmelden(Beobachter b){
beobachter.add(b);
}

public int getSpeedX(){
return speedX;
}

public int getSpeedY(){
return speedY;
}

public int getX(){
return xValue;
}

public int getY(){
return yValue;
}

public int getYPosition(){
return yValue;
}

//bestimmt in einem gewissen Rahmen zufällig die Bewegung des Gegners bzw. ob er schießen soll
//wird von move() siehe unten aufgerufen
//
public void setPosition(){
//bestimmt, ob Gegner nach links oder rechts fliegt
xRichtung=ThreadLocalRandom.current().nextInt(0, 2);
yRichtung=ThreadLocalRandom.current().nextInt(0, 2);
speedX=ThreadLocalRandom.current().nextInt(3, 7);
speedY=ThreadLocalRandom.current().nextInt(3, 7);
//Variable shot=int
shot=ThreadLocalRandom.current().nextInt(0, 8);

if(xRichtung==0){
//wenn xRichtung==0, wird xGeschwindigkeit negativ -> Gegner fliegt nach links
speedX=-speedX;
if(yRichtung==0){
//analog bei y
speedY=-speedY;
}
}else if(xRichtung==1){
if(yRichtung==0){
speedY=-speedY;
}
}
}

public void tryShoot(){
shot=ThreadLocalRandom.current().nextInt(0, 20);
/*wenn shot==0 wird geschossen -> oben bei der Generierung des Wertes für shot (siehe setPositon() Kommentare)
wird Wahrscheinlichkeit des Schusses festgelegt ->(hier 1/8)
*/
if(shot==0){
shoot=true;
}
}

public void setShoot(boolean b){
shoot=b;
}

public int getKey(){
return key;
}

public boolean getShoot(){
return shoot;
}

public void alleInformieren() {
for(Beobachter b: beobachter){
b.geändert();
}
}
//move() wird von Haupt-Timer in der Klasse Steuerung aufgerufen und setzt die Bewegung des Gegners neu, wenn er an den Spielfeldrand kommt
public void move(){
//der if-Zweig sorgt dafür, dass kein Gegner sich außerhalb des Spielfeldrandes bewegt
if((xValue<32 && speedX<0)|| (xValue>950 && speedX>0) || (yValue<40 && speedY<0) || (yValue>850 && speedY>0)){
setPosition();
}else{
xValue=xValue+speedX;
yValue=yValue+speedY;
}
}

public void stopMove(){
speedX=0;
speedY=0;
}
}
Binary file added GalaxyGame-Da-Whole-Thing/Gegner2.class
Binary file not shown.
29 changes: 29 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Gegner2.ctxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#BlueJ class context
comment0.target=Gegner2
comment1.params=x\ y\ bf\ mf\ l
comment1.target=Gegner2(int,\ int,\ int,\ int,\ int)
comment10.params=
comment10.target=int\ getKey()
comment11.params=
comment11.target=int\ getLength()
comment12.params=
comment12.target=void\ stopMove()
comment13.params=
comment13.target=void\ move()
comment2.params=b
comment2.target=void\ anmelden(Beobachter)
comment3.params=
comment3.target=int\ getSpeedX()
comment4.params=
comment4.target=int\ getSpeedY()
comment5.params=
comment5.target=int\ getX()
comment6.params=
comment6.target=int\ getY()
comment7.params=b
comment7.target=void\ setShoot(boolean)
comment8.params=
comment8.target=boolean\ getShoot()
comment9.params=
comment9.target=void\ alleInformieren()
numComments=14
113 changes: 113 additions & 0 deletions GalaxyGame-Da-Whole-Thing/Gegner2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import java.util.*;
import java.awt.*;
public class Gegner2 implements Gegner{

private int speedX, speedY, posX, posY, length, bulletFreq, maxCount, mCounter, bCounter, state;
private ArrayList<Beobachter> beobachter;
private int key;
private boolean shoot;
private Random rand;
private int screenHeight;
public Gegner2(int x, int y, int bf, int mf, int l) {
rand = new Random();
shoot = false;
posX = x;
posY = y;
length = l;
screenHeight= (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
speedX = 0;
speedY =(int) (screenHeight/204.8);
if(mf != 0){maxCount = mf;}
else{maxCount = rand.nextInt(150) + 50;}
mCounter = maxCount;
state = 1;
if(bf != 0){bulletFreq = bf;}
else{bulletFreq = rand.nextInt(285) + 16;}
bCounter = bulletFreq;
key = 1;
}

public void anmelden(Beobachter b){
beobachter.add(b);
}

public int getSpeedX(){
return speedX;
}

public int getSpeedY(){
return speedY;
}

public int getX(){
return posX;
}

public int getY(){
return posY;
}

public void setShoot(boolean b){
shoot=b;
}

public boolean getShoot(){
return shoot;
}

public void alleInformieren() {
for(Beobachter b: beobachter){
b.geändert();
}
}

public int getKey(){
return key;
}

public int getLength(){
return length;
}

public void stopMove(){
speedY = 0;
speedX = 0;
}

public void move(){
if(bCounter == 0){setShoot(true);
bCounter = bulletFreq;}
else{bCounter--;}
if(mCounter == 0){
mCounter = maxCount;
if(state == 0){
state = 1;
speedX = 5;
speedY = 0;
}
else if(state == 1){
state = 2;
speedX = 0;
speedY = (int) (screenHeight/204.8);
}
else if(state == 2){
state = 3;
speedX = -5;
speedY = 0;
}
else{
state = 0;
speedX = 0;
speedY = (int) (screenHeight/204.8);
}
}
else{
posX = posX + speedX;
if(posX < 0){posX = 1024 + posX;}
if(posX > 1024){posX = posX - 1024;}
posY = posY + speedY;
if(posY > 1024){posY = -64;}
mCounter--;
}
}
}
Binary file added GalaxyGame-Da-Whole-Thing/Gegner3.class
Binary file not shown.
Loading