Skip to content

Landscape Objects

Michelle edited this page Aug 26, 2022 · 28 revisions

Details about the design process can be found on this page.

General

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.

Environmental Component

CollisionEffect Component

CollisionEffectComponents allow EnvironmentalObjects 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

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.

The Damage & Knockback) Effect

By default DAMAGE also knocks back the entity. This behaviour can be changed by using SetKnockback() and setting knockback to 0f

Placement

Table of Contents

Home

How to Play

Introduction

Game Features

Main Character

Enemies
The Final Boss

Landscape Objects

Shop
Inventory
Achievements
Camera

Crystal

Infrastructure

Audio

User Interfaces Across All Pages
Juicy UI
User Interfaces Buildings
Guidebook
[Resource Management](Resource-Management)
Map
Day and Night Cycle
Unified Grid System (UGS)
Polishing

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally