Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ItemTestingUpdate #105

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e7de747
Merge pull request #7 from math-odd/main_to_develop
math-odd Oct 16, 2023
b8e6946
Merge pull request #12 from math-odd/BackToConflict
math-odd Oct 18, 2023
2830940
Merge branch 'main' of https://github.com/PurpleBananass/Invaders int…
math-odd Oct 19, 2023
0199b12
b4dev
math-odd Oct 23, 2023
ffa8a5b
Merge pull request #17 from PurpleBananass/main
jukanmi Nov 6, 2023
bb20216
Merge pull request #21 from PurpleBananass/main
math-odd Nov 6, 2023
47be1df
addboss
jukanmi Nov 11, 2023
c80d1a4
setEnemyShipHp
jukanmi Nov 11, 2023
a5ace06
shipPrivateIntModify
jukanmi Nov 11, 2023
ebdd667
Merge pull request #22 from math-odd/bossclassadd
jukanmi Nov 11, 2023
65f5259
add enum BossShip, BossShipDestroyed, BossShipMoved, add bossshipGrap…
jungchoib Nov 11, 2023
125fe5d
Merge branch 'develop' of https://github.com/math-odd/annoyingpotatoe…
math-odd Nov 11, 2023
447a994
Merge branch 'main' of https://github.com/math-odd/annoyingpotatoes i…
math-odd Nov 11, 2023
6b38a78
Merge pull request #23 from math-odd/add_enum_boss
jukanmi Nov 11, 2023
62ba33a
Merge branch 'develop' of https://github.com/math-odd/annoyingpotatoe…
math-odd Nov 19, 2023
2c2b269
implement split Function
jukanmi Nov 20, 2023
dd33e8b
addBossClassDefalut
jukanmi Nov 22, 2023
0006a79
res_differ
math-odd Nov 22, 2023
a7bbce8
Merge branch 'develop' of https://github.com/math-odd/annoyingpotatoe…
jukanmi Nov 22, 2023
ebb8939
Merge pull request #26 from math-odd/bossclassadd
math-odd Nov 22, 2023
d4d01f4
Merge branch 'develop' of https://github.com/math-odd/annoyingpotatoe…
math-odd Nov 22, 2023
69b9a7b
boss ship arg_func form added
math-odd Nov 22, 2023
2aaaef5
add randomness
math-odd Nov 23, 2023
21536eb
core_boss_stage_bool
yaho1231 Nov 25, 2023
9ee6358
Merge pull request #28 from math-odd/hotfixes
yaho1231 Nov 25, 2023
0089753
implement splitBoss
jukanmi Nov 25, 2023
92f0f60
Merge pull request #27 from math-odd/boss_move basic
jukanmi Nov 25, 2023
bb73561
Merge branch 'develop' into feature/splitboss
jukanmi Nov 25, 2023
42bf787
circle and cross
math-odd Nov 26, 2023
41d5f9c
Merge pull request #29 from math-odd/feature/splitboss
jukanmi Nov 27, 2023
8d1aefc
sprite_fix
yaho1231 Nov 27, 2023
1875b6a
Merge pull request #30 from math-odd/hotfixes
yaho1231 Nov 27, 2023
b90edf5
Merge pull request #31 from math-odd/boss_move
math-odd Nov 27, 2023
724b2ee
remakemanageCollisionsfunction
jukanmi Nov 27, 2023
558cfc4
move done
math-odd Nov 27, 2023
6e1bb80
Merge pull request #33 from math-odd/boss_move
math-odd Nov 27, 2023
78c0bf8
Merge pull request #32 from math-odd/refixCollision
jukanmi Nov 29, 2023
321442b
TestingFileUpload
yaho1231 Nov 29, 2023
bc4d961
TestingUpdate
yaho1231 Nov 29, 2023
9a602d0
item testing update
yaho1231 Dec 1, 2023
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 requirements/font.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions res/bossshipGraphics
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
50*30으로 추가할게요 보스쉽 여러가지 (default, destroyed, moved)
5 changes: 4 additions & 1 deletion res/graphics

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions res/scores_1p
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AAA
2280
15 changes: 8 additions & 7 deletions src/engine/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,26 @@ public final class Core {

/** Difficulty settings for level 1. */
private static final GameSettings SETTINGS_LEVEL_1 =
new GameSettings(5, 4, 60, 2000, 5.5);
new GameSettings(5, 4, 60, 2000, 5.5,false);
/** Difficulty settings for level 2. */
private static final GameSettings SETTINGS_LEVEL_2 =
new GameSettings(5, 5, 50, 2500, 5.5);
new GameSettings(5, 5, 50, 2500, 5.5,false);
/** Difficulty settings for level 3. */
private static final GameSettings SETTINGS_LEVEL_3 =
new GameSettings(6, 5, 40, 1500, 5.5);
new GameSettings(6, 5, 40, 1500, 5.5,false);
/** Difficulty settings for level 4. */
private static final GameSettings SETTINGS_LEVEL_4 =
new GameSettings(6, 6, 30, 1500, 5);
new GameSettings(6, 6, 30, 1500, 5,true);
/** Difficulty settings for level 5. */
private static final GameSettings SETTINGS_LEVEL_5 =
new GameSettings(7, 6, 20, 1000,5);
new GameSettings(7, 6, 20, 1000,5,true);
/** Difficulty settings for level 6. */
private static final GameSettings SETTINGS_LEVEL_6 =
new GameSettings(7, 7, 10, 1000,4.8);
new GameSettings(7, 7, 10, 1000,4.8,true);
/** Difficulty settings for level 7. */
private static final GameSettings SETTINGS_LEVEL_7 =
new GameSettings(8, 7, 2, 500,4.8);
new GameSettings(8, 7, 2, 500,4.8,true);

private static int LEVEL;

/** Frame to draw the screen on. */
Expand Down
13 changes: 11 additions & 2 deletions src/engine/DrawManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ public static enum SpriteType {
/** Bonus ship. */
EnemyShipSpecial,
/** Destroyed enemy ship. */
BossShip,
/** Boss enemy ship. */
BossShipDestroyed,
/** Boss enemy ship destroyed */
BossShipMoved,
/** Boss enemy ship movement */
Explosion,
Item,

Expand Down Expand Up @@ -138,6 +144,9 @@ private DrawManager() {
spriteMap.put(SpriteType.InvincibleShape, new boolean[5][5]);
spriteMap.put(SpriteType.SpeedUpShape, new boolean[5][4]);
spriteMap.put(SpriteType.AuxiliaryShape, new boolean[5][4]);
spriteMap.put(SpriteType.BossShip, new boolean[50][30]);
spriteMap.put(SpriteType.BossShipDestroyed, new boolean[50][30]);
spriteMap.put(SpriteType.BossShipMoved, new boolean[50][30]);

fileManager.loadSprite(spriteMap);

Expand Down Expand Up @@ -880,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 @@ -997,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
9 changes: 9 additions & 0 deletions src/engine/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ public InputStream checkSpriteType(SpriteType spriteType) {
} else if (spriteType == SpriteType.EnemyShipSpecial) {
inputStream = DrawManager.class.getClassLoader()
.getResourceAsStream("specialenemyGraphics");
} else if (spriteType == SpriteType.BossShip) {
inputStream = DrawManager.class.getClassLoader()
.getResourceAsStream("bossshipGraphics");
} else if (spriteType == SpriteType.BossShipDestroyed) {
inputStream = DrawManager.class.getClassLoader()
.getResourceAsStream("bossshipGraphics");
} else if (spriteType == SpriteType.BossShipMoved) {
inputStream = DrawManager.class.getClassLoader()
.getResourceAsStream("bossshipGraphics");
}
return inputStream;
}
Expand Down
14 changes: 13 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 Expand Up @@ -67,4 +69,14 @@ public final int getShootingFrecuency() {
return shootingFrecuency;
}

/**
* @return the bossStage
*/
public final boolean getBossStage(){return bossStage;}

/**
* @return the itemSpeed
*/
public final double getItemSpeed(){return itemSpeed;}

}
3 changes: 0 additions & 3 deletions src/engine/GameState.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,4 @@ public final int getShipsDestroyed2() {
return shipsDestroyed2;
}

public int livesRemaining1() {
return 0;
}
}
159 changes: 159 additions & 0 deletions src/entity/BossShip.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
package entity;

import engine.DrawManager;
import engine.GameState;

import java.util.List;


public class BossShip extends EnemyShip {
private final int SpeedY = -2;
/** Width of current screen. */
private static final int WIDTH = 448;
/** Height of current screen. */
private static final int HEIGHT = 520;
/** Width of boss ship. */
private static final int BOSS_WIDTH = 50;
/** Height of boss ship. */
private static final int BOSS_HEIGHT = 30;
private int splitLevel;

public BossShip (final int positionX, final int positionY,
final DrawManager.SpriteType spriteType, final GameState gameState, int splitLevel){
super(positionX, positionY, spriteType, gameState);
super.HP = splitLevel;//따로 수정;
super.pointValue = 100*splitLevel; //따로수정
this.splitLevel = splitLevel;
this.Move();
}

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

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

}

/**
* when Boss attack this function execute
*/
public void Move(){
while (this.HP > 0) {
int select = (int) (Math.random() * 7);
switch (select) {
case 0:
case 1:
moveCircle();
case 2:
case 3:
moveCross();
case 4:
case 5:
moveDiamond();
case 6:
case 7:
moveTeleport();
}
}
}

/**
* tell the direction of boss ship in perspective of gamer
* @return true if turn right
*/
public boolean isRight(){
double dValue = Math.random();
int lr = (int)(dValue * 2);
if (lr != 0){return true;} // right
else {return false;} // left
}

public int moveTrackSize(int nowShipX, int nowShipY){
double dValue = Math.random();
int minimX = Math.min((WIDTH - nowShipX - BOSS_WIDTH), nowShipX);
return (int)(dValue * Math.min(minimX, (HEIGHT - nowShipY - BOSS_HEIGHT)));
}

/**
* move along the circle track
*/
public void moveCircle() {
int r = moveTrackSize(positionX, positionY);
if (r <= 0){moveTeleport();}
else {
if(isRight()){int x = 1, y = -1;}
else {int x = -1, y = -1;}
for (int i = 1; i <= 360; i++) {
positionX += (int)(r * Math.sin((double) (i / (double) 360)));
positionY += (int)(r * Math.sin((double) (i / (double) 360)));
// 특정 조건에서 총도 쏘면 좋을 듯
}
}
}

/**
* move along the cross track
*/
public void moveCross() {
int r = moveTrackSize(positionX, positionY);
if (r <= 0){moveTeleport();}
else {
int forward;
if(isRight()){forward = 1;}
else {forward = -1;}
int i;
for (i = 1; i < r; i++){positionX += 1;}
for (i = 1; i < r; i++){positionX -= 1;}
for (i = 1; i < r; i++){positionY += forward;}
for (i = 1; i < 2*r-1; i++){positionY -= forward;}
for (i = 1; i < r; i++){positionY += forward;}
}
}

/**
* move along the diamond track
*/
public void moveDiamond() {
int r = moveTrackSize(positionX, positionY);
if (r <= 0){moveTeleport();}
else {
int i;
for (i = 1; i < r/2; i++){positionX += 1;positionY += 1;}
for (i = 1; i < r/2; i++){positionX -= 1;positionY += 1;}
for (i = 1; i < r/2; i++){positionX -= 1;positionY -= 1;}
for (i = 1; i < r/2; i++){positionX += 1;positionY -= 1;}
}
}

/**
* Teleport randomly
*/
public void moveTeleport() {
double randomX = Math.random();
double randomY = Math.random();
positionX = (int) (randomX * (WIDTH - BOSS_WIDTH));
positionY = (int) (randomY * (HEIGHT - BOSS_HEIGHT));
}
}
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
Loading