Skip to content

Effects Component and Collision Mechanics

Isaac Arli edited this page Sep 15, 2023 · 4 revisions

Overview

Component class in charge of the projectile effects for both single target projectiles and AOEs. The effects can be used in conjunction with different collision mechanics. This component was designed to create a wider variety of projectiles to be used for special mobs, mob bosses and towers.

Effects implemented in this class:

  • Fire ball: Deals damage to target based on hosts' CombatStatsComponent.
  • Burn: applies 5 ticks of damage from hosts' CombatStatsComponent over 5 seconds.
  • Slow: applies slow effect to targetEntity. If entity is a mob, speed and firing rate will be slowed. If entity is a tower, firing rate will be slowed.
  • Stun: applies stun effect to a target entity for 5 seconds.

Refer to Projectile Factory on how to use functionality from this class.

Typical Use-Cases

Tower

The tower entity will implement the special effects based on the tower design. For example, the Droid tower will implement the slow effect whereas the Fire tower will implement the burn effect.

Mob King

The mob king entity are also able to implement the combination of effects and collisions to differentiate itself from the general mobs. This is assumed that the mob kings apply the most amount of damage.

General Mobs

General mob entities are also able to use specific effect components when the game is progressing to a new level. This is assumed as levels will continue to get harder so mobs will become more powerful.

Customisation

Effect Projectileprojectilestun4burn4snow_ball4

There are 5 degrees of customisation:

  • targetLayer: Specify which layer of entities are valid targets (e.g PhysicsLayer.TOWER)
  • destination: the location the projectile should be shooting towards
  • speed: speed of the projectile
  • effect: the type of effect chosen - burn, slow or stun
  • aoe: if the projectile will have the AOE component

Pierce Fireballpierce2

3 degrees of customisation:

  • targetLayer: Specify which layer of entities are valid targets
  • destination: the location the projectile should be shooting towards
  • speed: speed of the projectile

Ricochet Fireballnew_projectile_4

4 degrees of customisation:

  • targetLayer: Specify which layer of entities are valid targets
  • destination: the location the projectile should be shooting towards
  • speed: speed of the projectile
  • bounceCount: how many times the projectile has ricocheted

Split Fireworks Fireball firework4

4 degrees of customisation:

  • targetLayer: Specify which layer of entities are valid targets
  • destination: the location the projectile should be shooting towards
  • speed: speed of the projectile
  • amount: number of fireworks after collision

Functionality

  • applySingleEffect: Used for a single projectile to apple damage to one entity only.
  • applyAoeEffect: Used for AOE projectiles to apple the damage of the effect to an area.
  • burnEffect: Applies 5 ticks of damage from hosts' CombatStatsComponent over 5 seconds. Specified through targetLayer.
  • slowEffect: Applies slow effect to targetEntity. Specified through targetLayer - if entity is a mob, speed and firing rate will be slowed. If entity is a tower, firing rate.
  • stunEffect: Applies the stun effect to the targetLayer. This effect will stop the entity from shooting/moving.

Best Practice

  • Components should have HitboxComponent ensures that entity will take damage/effect of the projectile
  • targetLayer should be clearly defined for correct application of projectile to specified entity
Clone this wiki locally