mapcreator git · master
SDL3 2.5D game and engine using assets, with map editor
C++ 99.3%git clone https://git.christianimmanuel.de/sdl-graphics/mapcreator.gitwget https://git.christianimmanuel.de/sdl-graphics/mapcreator/archive/mapcreator.tar.gzFix enemy animation reference
src/character/enemy.cpp | 3 ++- src/character/enemy.hpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/character/enemy.cpp b/src/character/enemy.cpp index 43e94c6..0d70777 100644 --- a/src/character/enemy.cpp +++ b/src/character/enemy.cpp @@ -15,7 +15,7 @@ EnemyAnimation Enemy::animation_all; size_t Enemy::tile_size = 64; Enemy::Enemy(WeaponType weapon_type, WeaponMaterial weapon_material, SDL_FPoint position, EnemyStats status) - : animation(animation_all), weapon(weapon_type, weapon_material) { + : weapon(weapon_type, weapon_material) { x = position.x; y = position.y; stats = status; @@ -49,6 +49,7 @@ Enemy::Enemy(WeaponType weapon_type, WeaponMaterial weapon_material, SDL_FPoint direction_blocked[WalkDirection::UP] = false; direction_blocked[WalkDirection::LEFT] = false; direction_blocked[WalkDirection::RIGHT] = false; + animation = animation_all; } void diff --git a/src/character/enemy.hpp b/src/character/enemy.hpp index 9e0bbdc..a8b17ca 100644 --- a/src/character/enemy.hpp +++ b/src/character/enemy.hpp @@ -118,7 +118,7 @@ class Enemy { AnimationData* active_anim; static EnemyAnimation animation_all; - EnemyAnimation& animation; + EnemyAnimation animation; WalkDirection direction; std::unordered_map<WalkDirection, bool> direction_blocked; bool direction_tested_up;