Skip to content

Commit

Permalink
Fixed a typo for EngineerBulletAnimationController and refined pierci…
Browse files Browse the repository at this point in the history
…ng projectile
  • Loading branch information
MiniSoda17 committed Sep 9, 2023
1 parent c23cab8 commit f2cef91
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ private void onCollisionStart(Fixture me, Fixture other) {
public void setDisposeOnHit(boolean disposeOnHit) {
this.disposeOnHit = disposeOnHit;
}

public void setKnockBack(float knockback) {
this.knockbackForce = knockback;
}
// private void onCollisionEnd(Fixture me, Fixture other) {
// // Nothing to do on collision end
// }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.csse3200.game.rendering.AnimationRenderComponent;
import com.csse3200.game.services.ServiceLocator; //used for sound

public class EngineerBulletsAnimationControlller extends Component{
public class EngineerBulletsAnimationController extends Component{
/** Event name constants */

AnimationRenderComponent animator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.csse3200.game.physics.components.PhysicsComponent;
import com.csse3200.game.physics.components.PhysicsMovementComponent;
import com.badlogic.gdx.math.Vector2;
import com.csse3200.game.components.projectile.EngineerBulletsAnimationControlller;
import com.csse3200.game.components.projectile.EngineerBulletsAnimationController;
import com.csse3200.game.components.projectile.MobProjectileAnimationController;
import com.csse3200.game.components.projectile.ProjectileAnimationController;
import com.csse3200.game.components.projectile.SnowBallProjectileAnimationController;
Expand Down Expand Up @@ -59,9 +59,29 @@ public static Entity createEffectProjectile(short targetLayer, Vector2 destinati
switch(effect) {
case FIREBALL -> {
projectile.addComponent(new EffectsComponent(targetLayer, 3, ProjectileEffects.FIREBALL, aoe));
AnimationRenderComponent animator =
new AnimationRenderComponent(
ServiceLocator.getResourceService()
.getAsset(BASE_PROJECTILE_ATLAS, TextureAtlas.class));
animator.addAnimation(START_ANIM, START_SPEED, Animation.PlayMode.NORMAL);
animator.addAnimation(FINAL_ANIM, FINAL_SPEED, Animation.PlayMode.NORMAL);

projectile
.addComponent(animator)
.addComponent(new ProjectileAnimationController());
}
case BURN -> {
projectile.addComponent(new EffectsComponent(targetLayer, 3, ProjectileEffects.BURN, aoe));
AnimationRenderComponent animator =
new AnimationRenderComponent(
ServiceLocator.getResourceService()
.getAsset(BASE_PROJECTILE_ATLAS, TextureAtlas.class));
animator.addAnimation(START_ANIM, START_SPEED, Animation.PlayMode.NORMAL);
animator.addAnimation(FINAL_ANIM, FINAL_SPEED, Animation.PlayMode.NORMAL);

projectile
.addComponent(animator)
.addComponent(new ProjectileAnimationController());
}
case SLOW -> {
projectile.addComponent(new EffectsComponent(targetLayer, 3, ProjectileEffects.SLOW, aoe));
Expand Down Expand Up @@ -95,6 +115,7 @@ public static Entity createEffectProjectile(short targetLayer, Vector2 destinati
public static Entity createPierceFireBall(short targetLayer, Vector2 destination, Vector2 speed) {
Entity fireBall = createFireBall(targetLayer, destination, speed);
fireBall.getComponent(TouchAttackComponent.class).setDisposeOnHit(false);
fireBall.getComponent(TouchAttackComponent.class).setKnockBack(0f);

return fireBall;
}
Expand Down Expand Up @@ -168,7 +189,7 @@ public static Entity createEngineerBullet(short targetLayer, Vector2 destination

projectile
.addComponent(animator)
.addComponent(new EngineerBulletsAnimationControlller());
.addComponent(new EngineerBulletsAnimationController());
// .addComponent(new SelfDestructOnHitComponent(PhysicsLayer.OBSTACLE));

return projectile;
Expand Down

0 comments on commit f2cef91

Please sign in to comment.