-
Notifications
You must be signed in to change notification settings - Fork 1
Projectile Structure
nqm.tien edited this page Oct 1, 2024
·
3 revisions
ProjectileComponent
manages the behavior and properties of projectiles in the game. Each projectile is instantiated when a weapon is fired and carries specific attributes, such as damage, speed, and special effects.
-
update()
: Updates the projectile's position and checks for collisions with other entities or environment obstacles. -
activate()
: Marks the projectile as active, allowing it to start moving toward its target. -
collide(Entity target)
: Handles the logic when the projectile collides with another entity, applying damage and effects as necessary.
ProjectileFactory
is responsible for creating instances of projectiles with specific configurations.
-
Entity createProjectile(ProjectileConfig stats, Vector2 direction)
: Creates a new Entity with projectile components configured based on the providedProjectileConfig
and direction.
-
loadConfigs()
: Loads the projectile configuration from the projectiles.json file. This file contains detailed properties for each type of projectile, such as speed, health, attack stats, and animations. This is a static method called during the initialization of the factory. It allows the factory to access predefined projectile properties throughout the class. -
create(String specification, Vector2 direction, Vector2 parentPosition)
: Factory method that returns a projectile entity based on the given specification, which can be "dragonProjectile", "kitsuneProjectile1", or "kitsuneProjectile2". The method uses the respective helper methods to create specific projectiles. -
createAnimator(String atlasPath, ProjectileConfigs.BaseProjectileConfig.ProjectileAnimations[] animations)
: Helper method to generate anAnimationRenderComponent
by loading animations from a texture atlas. Each projectile has its own atlas containing animation frames for its movement or attack actions. - Updated
createProjectile
: This method constructs a new projectile entity with a set of predefined components. It handles adding components for physics, combat stats, movement, hitboxes, and animations. It also configures the entity's size and collider based on the projectile's configuration.
ProjectileSpawner
handles the spawning of projectiles in the game when a weapon is fired.
-
spawnProjectile(Weapon weapon, Vector2 position, Vector2 direction)
: Spawns a projectile at the specified position in the direction of the weapon fire.
Design Choices
Utilities
Animals
Menus/screens
Character
- Character Animations
- Character's Inventory On Display
- Character's Inventory System
- Character's HealthBar
- Character's Interaction with Items
- Character achievements
- Saving Character
- Player-(and-other-NPC)-invincibility-frames
- Player Factory
- Scoring System
- Test Plan for Inventory System
- Test Plan for Player's Interaction with Items
- Test Plan for Player's Inventory Display
- Test Plan for Saving Character State
- Test Plan for Scoring System
Map
Weapon
- Weapon Overview
- Weapon Types
- Weapon Structure
- Weapon Stats Display
- Testing Plan for Weapon Factory
- Testing Plan for Firing Controller Component
- Testing Plan for Position Tracker Component
- Testing Plan for Weapon Animation Controller component
- Testing Plan for Concrete Melee Weapon class
- Testing Plan for Concrete Ranged Weapon class