Skip to content

Commit

Permalink
Eliminate the scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahnjunyoung1110 committed Dec 6, 2023
1 parent 49262ad commit 4c02221
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 6 deletions.
39 changes: 39 additions & 0 deletions Test/entity/BossTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package entity;

import engine.DrawManager;
import engine.GameState;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.Set;

import static org.junit.jupiter.api.Assertions.*;

class BossTest {
private Boss boss;
Set<Bullet> bullets;
@BeforeEach
void setUp() {
boss = new Boss(0,0, DrawManager.SpriteType.Boss,new GameState(1,1,1,1,1));
}

@Test
void doPattern() {
boss.doPattern(bullets);
for (Bullet bullet: bullets){
assertEquals(bullet.getSpeed(),4);
}
}

@Test
void bossShoot() {
}

@Test
void boosShootWithX() {
}

@Test
void bossAttacked() {
}
}
33 changes: 33 additions & 0 deletions Test/entity/BulletTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package entity;

import entity.Bullet;
import org.junit.jupiter.api.*;
import static org.junit.jupiter.api.Assertions.*;

class BulletTest {

private Bullet bullet;

@BeforeEach
void setUp() {
bullet = new Bullet(3, 80, 10, 0);
bullet.setXspeed(3);
}

@Test
void update() {
bullet.update();
assertEquals(6, bullet.getPositionX());
assertEquals(90, bullet.getPositionY());
}

void setXspeed(){
bullet.setXspeed(19);
assertEquals(19,bullet.getX_speed());
}

void setYspeed(){
bullet.setSpeed(23);
assertEquals(23,bullet.getSpeed());
}
}
6 changes: 0 additions & 6 deletions src/entity/Boss.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,6 @@ public final void bossAttacked() {
this.spriteType = SpriteType.Explosion;
}
}

public final void destroyByBomb(){
this.HP = 0;
this.isDestroyed = true;
this.spriteType = SpriteType.Explosion;
}
/**
* Checks if the ship has been destroyed.
*
Expand Down
3 changes: 3 additions & 0 deletions src/entity/Bullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public final int getSpeed() {
return this.y_speed;
}

public final int getX_speed(){
return this.x_speed;
}
public final int getShooter() {
return this.shooter;
}
Expand Down

0 comments on commit 4c02221

Please sign in to comment.