Skip to content

Commit

Permalink
Added more weapons, on hit you'll loose weapons, decreased droprates,
Browse files Browse the repository at this point in the history
changed raw of drops, changed the way ammo works, changed shoot rates of
player, changed drop rate of special monsters
  • Loading branch information
Totenfluch committed Apr 10, 2016
1 parent 1cd8ea1 commit f096db5
Show file tree
Hide file tree
Showing 12 changed files with 312 additions and 18 deletions.
6 changes: 5 additions & 1 deletion Blockinvaders/src/me/game/pack/Drop.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public Drop(double xPos, double yPos, Drops drop){
this.drop = drop;
}

public Drops getDroptype(){
return drop;
}

public void assign(Player p){
Random r = new Random();

Expand All @@ -34,7 +38,7 @@ public void assign(Player p){
break;

case ADDAMMO:
p.waffe.addAmmo(40+r.nextInt(100));
p.waffe.addAmmo(20+r.nextInt(50));
break;

case NEXTWEAPON:
Expand Down
38 changes: 38 additions & 0 deletions Blockinvaders/src/me/game/pack/DualsWeapon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package me.game.pack;


public class DualsWeapon extends PlayerWeapon{

double bulletW = 3.0,
bulletH = 3.0;

public DualsWeapon(Player Besitzer, int damage, int delay, int bulletSpeed) {
super(Besitzer, 25, 14, 4);
typ = WaffenTyp.DUALS;
}

public DualsWeapon(Player Besitzer, int ammo) {
super(Besitzer, 25, 14, 4);
typ = WaffenTyp.DUALS;
this.ammo = ammo;
}

@Override
public void shoot(double playerX, double playerY) {
if(ammo > 0) {
if(delay <= 0){
delay = INIT_DELAY;
ammo--;
kugeln.add(new PlayerBullet(this, playerX-6, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+10, 0));
kugeln.add(new PlayerBullet(this, playerX+6, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+10, 0));
}
}else{
if(delay <= 0){
delay = INIT_DELAY;
kugeln.add(new PlayerBullet(this, playerX-6, playerY, bulletH, bulletW, bulletSpeed, damage, 0));
kugeln.add(new PlayerBullet(this, playerX+6, playerY, bulletH, bulletW, bulletSpeed, damage, 0));
}
}
}

}
42 changes: 42 additions & 0 deletions Blockinvaders/src/me/game/pack/FiveWeapon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package me.game.pack;


public class FiveWeapon extends PlayerWeapon{
double bulletW = 3.0,
bulletH = 3.0;

public FiveWeapon(Player Besitzer, int damage, int delay, int bulletSpeed) {
super(Besitzer, 35, 20, 7);
typ = WaffenTyp.FIVE;
}

public FiveWeapon(Player Besitzer, int ammo) {
super(Besitzer, 35, 20, 7);
typ = WaffenTyp.FIVE;
this.ammo = ammo;
}

@Override
public void shoot(double playerX, double playerY) {
if(ammo > 0) {
if(delay <= 0){
delay = INIT_DELAY;
ammo--;
kugeln.add(new PlayerBullet(this, playerX+2, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+15, 16));
kugeln.add(new PlayerBullet(this, playerX+1, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+15, 10));
kugeln.add(new PlayerBullet(this, playerX, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+15, 0));
kugeln.add(new PlayerBullet(this, playerX+1, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+15, -10));
kugeln.add(new PlayerBullet(this, playerX+2, playerY, bulletH+4, bulletW+4, bulletSpeed, damage+15, -16));
}
}else{
if(delay <= 0){
delay = INIT_DELAY;
kugeln.add(new PlayerBullet(this, playerX+2, playerY, bulletH, bulletW, bulletSpeed, damage, 16));
kugeln.add(new PlayerBullet(this, playerX+1, playerY, bulletH, bulletW, bulletSpeed, damage, 10));
kugeln.add(new PlayerBullet(this, playerX, playerY, bulletH, bulletW, bulletSpeed, damage, 0));
kugeln.add(new PlayerBullet(this, playerX-1, playerY, bulletH, bulletW, bulletSpeed, damage, -10));
kugeln.add(new PlayerBullet(this, playerX-2, playerY, bulletH, bulletW, bulletSpeed, damage, -16));
}
}
}
}
39 changes: 31 additions & 8 deletions Blockinvaders/src/me/game/pack/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Random;
import java.util.Vector;

import me.game.pack.Drop.Drops;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
Expand Down Expand Up @@ -169,7 +170,7 @@ else if(i == 3)
}

Random r = new Random();
if(r.nextInt(1600-clearcount*50) == 1){
if(r.nextInt(3200-clearcount*75) == 1){
Monti.getWaffe().shoot(Monti.getX(), Monti.getY());
}
alives++;
Expand All @@ -182,15 +183,22 @@ else if(i == 3)
Monti.setInitHp(Monster_HP+20*clearcount);
Monti.setLeben(Monster_HP+20*clearcount);
Monti.setWorth(Monti.getWorth()+1);
Monti.setColor(Color.BROWN);
}
}


gc.setFont(new Font("Impact", 30));
gc.setFont(new Font("Impact", 20));
if(Players.elementAt(0).isAlive()){
gc.setFill(Color.LIGHTGRAY);
gc.fillText(""+Players.elementAt(0).waffe.getAmmo(), 50, 100);
StringBuffer swb = new StringBuffer();
//gc.fillText(""+Players.elementAt(0).waffe.getAmmo(), 50, 100);
swb.append(Players.elementAt(0).waffe.typ.toString() + ": ");
for(int i = 0; i<Players.elementAt(0).waffe.getAmmo(); i++)
swb.append("|");
gc.fillText(swb.toString(), 50, 100);
}
gc.setFont(new Font("Impact", 30));
gc.setFill(Color.BLUEVIOLET);
gc.fillText(""+Players.elementAt(0).getScore(), 50, 50);
gc.setFill(Color.RED);
Expand All @@ -203,11 +211,17 @@ else if(i == 3)
gc.fillText("DEAD", 45, 80);

if(Players.size() > 1){
gc.setFont(new Font("Impact", 30));
gc.setFont(new Font("Impact", 20));
if(Players.elementAt(1).isAlive()){
gc.setFill(Color.LIGHTGRAY);
gc.fillText(""+Players.elementAt(1).waffe.getAmmo(), 50, 875);
//gc.fillText(""+Players.elementAt(1).waffe.getAmmo(), 50, 875);
StringBuffer swb2 = new StringBuffer();
swb2.append(Players.elementAt(1).waffe.typ.toString() + ": ");
for(int i = 0; i<Players.elementAt(1).waffe.getAmmo(); i++)
swb2.append("|");
gc.fillText(swb2.toString(), 50, 875);
}
gc.setFont(new Font("Impact", 30));
gc.setFill(Color.LIME);
gc.fillText(""+Players.elementAt(1).getScore(), 50, 825);
gc.setFill(Color.RED);
Expand Down Expand Up @@ -235,11 +249,20 @@ else if(i == 3)
}
}

gc.setFill(Color.GOLD);
for(int i = 0; i<Drop.AllDrops.size(); i++){
Drop p = Drop.AllDrops.elementAt(i);
gc.fillRect(p.xPos, p.yPos, Drop.DropSizeX, Drop.DropSizeY);
Drops pd = p.getDroptype();
if(pd.equals(Drops.NEXTWEAPON))
gc.setFill(Color.GOLD);
else if(pd.equals(Drops.ADDAMMO))
gc.setFill(Color.AQUAMARINE);
else if(pd.equals(Drops.ADDLEBEN))
gc.setFill(Color.FIREBRICK);
else if(pd.equals(Drops.ADDSCORE))
gc.setFill(Color.BLUE);
gc.fillOval(p.xPos, p.yPos, Drop.DropSizeX, Drop.DropSizeY);
}
gc.setFill(Color.GOLD);

gc.setFont(new Font("Impact", 20));
gc.fillText("Wave: " + (clearcount+1), GAME_WIDTH/2-30, 40);
Expand Down Expand Up @@ -309,7 +332,7 @@ public static void switchSceneToGame(){
if(x%2 == 0)
sub = 50;

Monsters[i] = new Monster(null, Monster_HP, sub+600+ix*50, x*100, 30, 20, 1, Color.BROWN);
Monsters[i] = new Monster(null, Monster_HP, sub+600+ix*50, x*100+50, 30, 20, 1, Color.BROWN);
Monsters[i].giveWeapon(new MonsterStandardWaffe(Monsters[i]));
}
Players.add(P1);
Expand Down
46 changes: 46 additions & 0 deletions Blockinvaders/src/me/game/pack/MaxWeapon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package me.game.pack;


public class MaxWeapon extends PlayerWeapon{
double bulletW = 3.0,
bulletH = 3.0;

public MaxWeapon(Player Besitzer, int damage, int delay, int bulletSpeed) {
super(Besitzer, 60, 25, 9);
typ = WaffenTyp.MAX;
}

public MaxWeapon(Player Besitzer, int ammo) {
super(Besitzer, 60, 25, 9);
typ = WaffenTyp.MAX;
this.ammo = ammo;
}

@Override
public void shoot(double playerX, double playerY) {
if(ammo > 0) {
if(delay <= 0){
delay = INIT_DELAY;
ammo--;
kugeln.add(new PlayerBullet(this, playerX+12, playerY+6, bulletH+3, bulletW+3, bulletSpeed, damage+15, 40));
kugeln.add(new PlayerBullet(this, playerX+8, playerY+4, bulletH+3, bulletW+3, bulletSpeed, damage+15, 15));
kugeln.add(new PlayerBullet(this, playerX+4, playerY+2, bulletH+3, bulletW+3, bulletSpeed, damage+15, 10));
kugeln.add(new PlayerBullet(this, playerX, playerY, bulletH+3, bulletW+3, bulletSpeed, damage+15, 0));
kugeln.add(new PlayerBullet(this, playerX-4, playerY+2, bulletH+3, bulletW+3, bulletSpeed, damage+15, -10));
kugeln.add(new PlayerBullet(this, playerX-8, playerY+4, bulletH+3, bulletW+3, bulletSpeed, damage+15, -15));
kugeln.add(new PlayerBullet(this, playerX-12, playerY+6, bulletH+3, bulletW+3, bulletSpeed, damage+15, -40));
}
}else{
if(delay <= 0){
delay = INIT_DELAY;
kugeln.add(new PlayerBullet(this, playerX+12, playerY+6, bulletH, bulletW, bulletSpeed, damage, 40));
kugeln.add(new PlayerBullet(this, playerX+8, playerY+4, bulletH, bulletW, bulletSpeed, damage, 15));
kugeln.add(new PlayerBullet(this, playerX+4, playerY+2, bulletH, bulletW, bulletSpeed, damage, 10));
kugeln.add(new PlayerBullet(this, playerX, playerY, bulletH, bulletW, bulletSpeed, damage, 0));
kugeln.add(new PlayerBullet(this, playerX-4, playerY+2, bulletH, bulletW, bulletSpeed, damage, -10));
kugeln.add(new PlayerBullet(this, playerX-8, playerY+4, bulletH, bulletW, bulletSpeed, damage, -15));
kugeln.add(new PlayerBullet(this, playerX-12, playerY+6, bulletH, bulletW, bulletSpeed, damage, -40));
}
}
}
}
6 changes: 4 additions & 2 deletions Blockinvaders/src/me/game/pack/Monster.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ public boolean subLeben(int amount){

public void TriggerDeath(){
Random r = new Random();
if(r.nextInt(5) == 1){
Drops[] theDrops = Drops.values();
Drops[] theDrops = Drops.values();
if(r.nextInt(10) == 1){
Drop.AllDrops.add(new Drop(xPos, yPos, theDrops[r.nextInt(theDrops.length)]));
}else if(color.equals(Color.DARKMAGENTA)){
Drop.AllDrops.add(new Drop(xPos, yPos, theDrops[r.nextInt(theDrops.length)]));
}
}
Expand Down
1 change: 1 addition & 0 deletions Blockinvaders/src/me/game/pack/MonsterBullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public void refresh(){
m.setInitHp(m.getInitHp() + 300);
m.setLeben(m.getInitHp());
m.setColor(Color.DARKMAGENTA);
p.giveWeapon(((PlayerWeapon) p.waffe).prevWaffe());
}
}
}
Expand Down
47 changes: 45 additions & 2 deletions Blockinvaders/src/me/game/pack/PlayerWeapon.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

public abstract class PlayerWeapon extends Weapon {

protected enum WaffenTyp {STANDARD, SHOTGUN };
protected WaffenTyp typ;
protected enum WaffenTyp {STANDARD, DUALS, SHOTGUN, QUAD, FIVE, SIX, MAX };


public static Vector<PlayerWeapon> ActiveWeapons = new Vector<PlayerWeapon>();

Expand Down Expand Up @@ -34,8 +34,51 @@ public PlayerWeapon nextWaffe() {

switch (typ) {
case STANDARD:
return new DualsWeapon((Player)this.Besitzer, this.ammo);

case DUALS:
return new Shotgun((Player)this.Besitzer, this.ammo);

case SHOTGUN:
return new QuadWeapon((Player)this.Besitzer, this.ammo);

case QUAD:
return new FiveWeapon((Player)this.Besitzer, this.ammo);

case FIVE:
return new SixWeapon((Player)this.Besitzer, this.ammo);

case SIX:
return new MaxWeapon((Player)this.Besitzer, this.ammo);

default:
return this;
}
}

public PlayerWeapon prevWaffe(){
switch (typ) {
case STANDARD:
return this;

case DUALS:
return new StandardWaffe((Player)this.Besitzer, this.ammo);

case SHOTGUN:
return new DualsWeapon((Player)this.Besitzer, this.ammo);

case QUAD:
return new Shotgun((Player)this.Besitzer, this.ammo);

case FIVE:
return new QuadWeapon((Player)this.Besitzer, this.ammo);

case SIX:
return new FiveWeapon((Player)this.Besitzer, this.ammo);

case MAX:
return new SixWeapon((Player)this.Besitzer, this.ammo);

default:
return this;
}
Expand Down
43 changes: 43 additions & 0 deletions Blockinvaders/src/me/game/pack/QuadWeapon.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package me.game.pack;


public class QuadWeapon extends PlayerWeapon{

double bulletW = 3.0,
bulletH = 3.0;

public QuadWeapon(Player Besitzer, int damage, int delay, int bulletSpeed) {
super(Besitzer, 30, 18, 6);
typ = WaffenTyp.QUAD;
}

public QuadWeapon(Player Besitzer, int ammo) {
super(Besitzer, 30, 18, 6);
typ = WaffenTyp.QUAD;
this.ammo = ammo;
}

@Override
public void shoot(double playerX, double playerY) {
if(ammo > 0) {
if(delay <= 0){
delay = INIT_DELAY;
ammo--;
kugeln.add(new PlayerBullet(this, playerX-12, playerY, bulletH+3, bulletW+3, bulletSpeed, damage+10, 0));
kugeln.add(new PlayerBullet(this, playerX+12, playerY, bulletH+3, bulletW+3, bulletSpeed, damage+10, 0));
kugeln.add(new PlayerBullet(this, playerX-7, playerY-6, bulletH+3, bulletW+3, bulletSpeed, damage+10, 0));
kugeln.add(new PlayerBullet(this, playerX+7, playerY-6, bulletH+3, bulletW+3, bulletSpeed, damage+10, 0));
}
}
else{
if(delay <= 0){
delay = INIT_DELAY;
kugeln.add(new PlayerBullet(this, playerX-12, playerY, bulletH, bulletW, bulletSpeed, damage, 0));
kugeln.add(new PlayerBullet(this, playerX+12, playerY, bulletH, bulletW, bulletSpeed, damage, 0));
kugeln.add(new PlayerBullet(this, playerX-7, playerY-6, bulletH, bulletW, bulletSpeed, damage, 0));
kugeln.add(new PlayerBullet(this, playerX+7, playerY-6, bulletH, bulletW, bulletSpeed, damage, 0));
}
}
}

}
Loading

0 comments on commit f096db5

Please sign in to comment.