New enemies

rework existing enemies or create new ones

Reworking enemy stats

to create enmies with custom speed, health and damage stats you can add new instances of the EnemyStats struct to std::vector<EnemyStats> _enemies defined in src/server/Game.hpp. afterwards you can refer to them in the level fevel files wither their index in the vector (0,1,2,...)

struct EnemyStats {
    int health;
    int damage;
    Animation::AnimationID sprite;
    float speed;
    Armament::Type armament;
};


// inside Game class

std::vector<EnemyStats> _enemies = {
    {10, 5, Animation::AnimationID::Orb, 8.0, Armament::Type::Laser},
    {20, 25, Animation::AnimationID::Orb, 10.0, Armament::Type::Laser},
    {30, 15, Animation::AnimationID::Orb, 3.0, Armament::Type::Laser},
    {50, 50, Animation::AnimationID::Orb, 1.0, Armament::Type::Laser},
    // add new instance here
};

Look into the New levels Tutorial to see more on how to define enemies in a level

Create new Weapon

The weapons are defined as Armament::Type's.

1. Create new Armament::Type enum in Components.hpp

use this enum in your EnemyType struct as descibed above

2. Add enum to switch in src/server/ArmamentSystems.cpp

3. Call your attack function in the Factory::Weapon namespace

you can also use othe premade functions above.

4. Define new attack function in the Factory::Weapon namespace

This is the current default attack function in src/server/Systems/Factory.cpp

you can use the bullet function to create projectiles

the three integer arguments are velocity on x-achsis, velocity on y-achsis and rotation.

Since bullets are entities like enimies and players they are created very silarly. Have a look at the bullet fucntion src/server/Systems/Factory.cpp

bullets consit of:

Position::Component

Veclocity::Compotent

Team::Component

Health::Compotent

Damage::Component

Animation::Component

Hitbox::Component

CollisionEffect::Component

SoundCreation::Component

SoundDestruction::Component

use these components to creat customize projectiles. check ECS documentation for more info on the components.

Custom animation

find out how to add new spritesheets and animations in New Graphics

Last updated