Skip to content

Commit

Permalink
Merge pull request #26 from math-odd/bossclassadd
Browse files Browse the repository at this point in the history
Bossclassadd-seyoon_CHECKED
  • Loading branch information
math-odd authored Nov 22, 2023
2 parents 6b38a78 + a7bbce8 commit ebb8939
Show file tree
Hide file tree
Showing 6 changed files with 727 additions and 651 deletions.
4 changes: 2 additions & 2 deletions src/engine/DrawManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public void drawGameOver(final Screen screen, final boolean acceptsInput,
Ship dummyShip2 = new Ship(0, 0, Color.RED, SpriteType.Ship, true);
shipskin[i] = dummyShip;
shipskin2[i] = dummyShip2;
// : ships[i] = new Ship(i * 50, 100, Color.GREEN, SpriteType.Ship, spriteData, false);
// ?˜ˆ: ships[i] = new Ship(i * 50, 100, Color.GREEN, SpriteType.Ship, spriteData, false);
drawEntity(shipskin[i], screen.getWidth() / 4 - 13, 172 + 50*i);
drawEntity(shipskin2[i], 3*screen.getWidth() / 4 - 13, 172 + 50*i);
if(i !=5) {
Expand Down Expand Up @@ -1006,7 +1006,7 @@ public void drawGameOver(final Screen screen, final boolean acceptsInput,
for (int i = 0; i < 6; i++) {
Ship dummyShip = new Ship(0, 0, Color.GREEN, SpriteType.Ship, false);
shipskin[i] = dummyShip;
// : ships[i] = new Ship(i * 50, 100, Color.GREEN, SpriteType.Ship, spriteData, false);
// ?˜ˆ: ships[i] = new Ship(i * 50, 100, Color.GREEN, SpriteType.Ship, spriteData, false);
drawEntity(shipskin[i], screen.getWidth() / 2 - 13, 172 + 50*i);
if(i !=5) {
try {
Expand Down
4 changes: 3 additions & 1 deletion src/engine/GameSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class GameSettings {
private int shootingFrecuency;
/** Speed of item dropping. */
private double itemSpeed;
private boolean bossStage;
/**
* Constructor.
*
Expand All @@ -31,12 +32,13 @@ public class GameSettings {
* Frecuency of enemy shootings, +/- 30%.
*/
public GameSettings(final int formationWidth, final int formationHeight,
final int baseSpeed, final int shootingFrecuency, final double itemSpeed) {
final int baseSpeed, final int shootingFrecuency, final double itemSpeed, final boolean bossStage) {
this.formationWidth = formationWidth;
this.formationHeight = formationHeight;
this.baseSpeed = baseSpeed;
this.shootingFrecuency = shootingFrecuency;
this.itemSpeed = itemSpeed;
this.bossStage = bossStage;
}

/**
Expand Down
48 changes: 47 additions & 1 deletion src/entity/BossShip.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,61 @@
import engine.DrawManager;
import engine.GameState;

import java.util.ArrayList;
import java.util.List;

public class BossShip extends EnemyShip {
private List<BossShip> SplitList;
private final int SpeedX = -2;
/** Width of current screen. */
private static final int WIDTH = 448;
/** Height of current screen. */
private static final int HEIGHT = 520;
private int splitLevel;

public BossShip (final int positionX, final int positionY,
final DrawManager.SpriteType spriteType, final GameState gameState){
final DrawManager.SpriteType spriteType, final GameState gameState, final int splitLevel){
super(positionX, positionY, spriteType, gameState);
super.HP = 0;//따로 수정;
super.pointValue = 0; //따로수정
this.splitLevel = splitLevel;
SplitList = new ArrayList<>();
SplitList.add(this);
}

/**
* when slime Boss dead this function
*/
public void split() {
int currentX = this.positionX, currentY = this.positionY;
if (this.splitLevel <= 0) return;
currentX += 10;
if (currentY < 20) currentY += 50;
if (WIDTH - 20 < currentY) currentY -= 50;
int firstY = currentY - 20, secondY = currentY + 20;
BossShip first = new BossShip(currentX, firstY, DrawManager.SpriteType.EnemyShipA1, this.gameState, this.splitLevel - 1);
BossShip second = new BossShip(currentX, secondY, DrawManager.SpriteType.EnemyShipA1, this.gameState, this.splitLevel - 1);
SplitList.add(first);
SplitList.add(second);
}
/**
* when Boss Die this function execute
*/
public void Death(){

}

/**
* when Boss attack this function execute
*/
public void Attack() {

}

/**
* when Boss attack this function execute
*/
public void Move(){

}
}
4 changes: 2 additions & 2 deletions src/entity/EnemyShip.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class EnemyShip extends Entity {
/** Cooldown between sprite changes. */
protected Cooldown animationCooldown;
/** Checks if the ship has been hit by a bullet. */
private boolean isDestroyed;
protected boolean isDestroyed;
/** 난이도 조절에 사용할 현재 스테이트 */
private GameState gameState;
protected GameState gameState;
/** Values of the ship, in points, when destroyed. */
protected int pointValue;

Expand Down
68 changes: 40 additions & 28 deletions src/entity/EnemyShipA.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,50 @@
import engine.Cooldown;
import engine.DrawManager;
import engine.GameState;

import java.util.Set;

public class EnemyShipA extends EnemyShip {
/** HP의 배율 */
private final double HPPOWER = .8;
/** 총알의 속도 배율 */
private final double BULLETSPEEDPOWER = 0.5;
/** 슈팅 쿨다운 배율 */
private final double BULLETCOOLDOWN = 0;
/** 제거시 올라가는 점수 */
private final int POINT = 30;
public EnemyShipA(final int positionX, final int positionY,
final DrawManager.SpriteType spriteType, final GameState gameState) {
super(positionX, positionY, spriteType, gameState);
super.HP = (int)(super.HP * HPPOWER);
super.pointValue = POINT;
}
/** HP의 배율 */
private final double HPPOWER = .8;
/** 총알의 속도 배율 */
private final double BULLETSPEEDPOWER = 5;
/** 슈팅 쿨다운 배율 */
private final double BULLETCOOLDOWN = 0;
/** 제거시 올라가는 점수 */
private final int POINT = 30;

public final void update() {
if (this.animationCooldown.checkFinished()) {
this.animationCooldown.reset();
if (spriteType == DrawManager.SpriteType.EnemyShipA1)
spriteType = DrawManager.SpriteType.EnemyShipA2;
else
spriteType = DrawManager.SpriteType.EnemyShipA1;
}
}
public final void shoot(final Set<Bullet> bullets, Cooldown shootingCooldown) {
bullets.add(BulletPool.getBullet(positionX
+ width / 2, positionY, (int)(super.BULLET_SPEED * BULLETSPEEDPOWER),0));
shootingCooldown.timedown(BULLETCOOLDOWN);
public EnemyShipA(
final int positionX,
final int positionY,
final DrawManager.SpriteType spriteType,
final GameState gameState
) {
super(positionX, positionY, spriteType, gameState);
super.HP = (int) (super.HP * HPPOWER);
super.pointValue = POINT;
}

public final void update() {
if (this.animationCooldown.checkFinished()) {
this.animationCooldown.reset();
if (spriteType == DrawManager.SpriteType.EnemyShipA1) spriteType =
DrawManager.SpriteType.EnemyShipA2; else spriteType =
DrawManager.SpriteType.EnemyShipA1;
}
}

public final void shoot(
final Set<Bullet> bullets,
Cooldown shootingCooldown
) {
bullets.add(
BulletPool.getBullet(
positionX + width / 2,
positionY,
(int) (super.BULLET_SPEED * BULLETSPEEDPOWER),
0
)
);
shootingCooldown.timedown(BULLETCOOLDOWN);
}
}
Loading

0 comments on commit ebb8939

Please sign in to comment.