Skip to content

Commit

Permalink
Tested size and speed of MobKingBall. Added implementation to RangeBo…
Browse files Browse the repository at this point in the history
…ssMovementTask
  • Loading branch information
cindyle1 committed Sep 9, 2023
1 parent 114591b commit b358787
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public class RangeBossMovementTask extends DefaultTask implements PriorityTask {
private MovementTask movementTask;
private WaitTask waitTask;
private Task currentTask;
/** Animation event names */
private static final String START = "startMobKing";
private static final String FINAL = "startMobKingFinal";
private enum STATE {
START, FINAL
}
private STATE bossBallState = STATE.START;

/**
* @param waitTime How long in seconds to wait between wandering.
Expand Down Expand Up @@ -54,13 +61,23 @@ public void start() {
this.owner.getEntity().getEvents().trigger("rangeBossMovementStart");
}

public void switchMobKingBallState() {
switch (bossBallState) {
case START:
owner.getEntity().getEvents().trigger(FINAL);
bossBallState = STATE.FINAL;
}
}

@Override
public void update() {
if (currentTask.getStatus() != Status.ACTIVE) {
if (currentTask == movementTask) {
Entity newProjectile = ProjectileFactory.createFireBall(PhysicsLayer.OBSTACLE, new Vector2(0, currentPos.y + 0.75f), new Vector2(2f,2f));

newProjectile.scaleHeight(-0.4f);
Entity newProjectile = ProjectileFactory.createMobKingBall(
PhysicsLayer.HUMANS, new Vector2(0, currentPos.y + 0.75f), new Vector2(2f,2f));
owner.getEntity().getEvents().trigger(START);
switchMobKingBallState();
newProjectile.scaleHeight(-0.6f);
newProjectile.setPosition((float) (currentPos.x), (float) (currentPos.y+0.75f));
ServiceLocator.getEntityService().register(newProjectile);
startWaiting();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public void start() {
this.owner.getEntity().getEvents().trigger(START);
this.owner.getEntity().getEvents().trigger("rotate");
this.owner.getEntity().getEvents().trigger("start");
this.owner.getEntity().getEvents().trigger("startMobKing");
}

public void switchProjectileState() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.csse3200.game.components.TouchAttackComponent;
import com.csse3200.game.components.RicochetComponent;
import com.csse3200.game.components.SplitFireworksComponent;
import com.csse3200.game.components.projectile.MobKingProjectAnimController;
import com.csse3200.game.components.tasks.TrajectTask;
import com.csse3200.game.ai.tasks.AITaskComponent;
import com.csse3200.game.components.CombatStatsComponent;
Expand Down Expand Up @@ -202,16 +203,16 @@ public static Entity createMobKingBall(short targetLayer, Vector2 destination, V
new AnimationRenderComponent(
ServiceLocator.getResourceService()
.getAsset("images/projectiles/mobKing_projectile.atlas", TextureAtlas.class));
animator.addAnimation("mob_boss", 0.1f, Animation.PlayMode.NORMAL);
animator.addAnimation("mob_bossFinal", 0.1f, Animation.PlayMode.NORMAL);
animator.addAnimation("mob_boss", 0.17f, Animation.PlayMode.NORMAL);
animator.addAnimation("mob_bossFinal", 0.17f, Animation.PlayMode.NORMAL);


projectile
.addComponent(animator)
.addComponent(new MobProjectileAnimationController());
.addComponent(new MobKingProjectAnimController());

// projectile
// .getComponent(AnimationRenderComponent.class).scaleEntity();
projectile
.getComponent(AnimationRenderComponent.class).scaleEntity();

return projectile;
}
Expand Down

0 comments on commit b358787

Please sign in to comment.