-
Notifications
You must be signed in to change notification settings - Fork 0
Landscape Objects
Details about the design process can be found on this page.
Landscape objects are Entities
that implement EnvironmentalComponent
. They may also implement CollisionEffectComponent
. They are generated in the ObstacleFactory, and placed on the map in the ForestGameArea file. They are removable by the player.
CollisionEffectComponent
s allow EnvironmentalObject
s to enact various effects on the player/npcs. These effects include:
-
SLOW
(although this is a misnomer as they can also be used to increase speed - simply give the EnvironmentalComponent a speed aspect > 1) DAMAGE
KNOCKBACK
- and basic collision effects (
DIVERT
&NONE
)
Entities implementing CollisionEffectComponent
should also implement ColliderComponent
, PhysicsComponent
, and EnvironmentalComponent
. If you want the effect to extend past the bounds of the collider (i.e. in an area of effect), HitboxComponent
should also be implemented and given a size
Effects can be configured to effect either the player, npcs, or both. By default, effects work on all entities that collide with them, but this can be changed using SetEffectTarget()
and the EffectTarget
enum.
The effects work using the engine's collision handler, and effects are applied on collision and, if necessary, removed when the collision ends.
The SLOW
effect is implemented by accessing a method added to player & NPC movement components (SetPlayerSpeed()
in PlayerActions.java
and SetMaxSpeed()
in PhysicsMovementComponent.java
respectively. Speed is changed by multiplying the entity's current speed by the speedModifier
, and this debuff is removed on collision end by multiplying the speed by 1/speedModifier
. We have tried to test to ensure floating point errors don't end up with the entity moving at a drastically different speed after many collisions, but this is still possible. the ResetSpeed()
functions can be implemented to fix this if necessary.
Initially, we tried to implement the SLOW
effect using the engine's physics library & applying friction / linear damping. If you are considering refactoring this effect to be used in this way, tread carefully! It will (we think) require some tinkering with the engine's PreSolve
function in the PhysicsContactListener
to add additional friction between colliding bodies regardless of the friction on individual bodies.
By default DAMAGE
also knocks back the entity. This behaviour can be changed by using SetKnockback()
and setting knockback to 0f