Nimbin[12]?SDL & Graphics / mapcreator / commits / 663480c

mapcreator git · master

SDL3 2.5D game and engine using assets, with map editor

sdl3 c++ game engine map-editor cmake · first commit 2025-10-31 · last commit 2026-09-07 (1 month ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-spieleentwicklung/map_creator

C++ 99.3%
git clone https://git.christianimmanuel.de/sdl-graphics/mapcreator.gitwget https://git.christianimmanuel.de/sdl-graphics/mapcreator/archive/mapcreator.tar.gz

Fix enemy animation reference

Christian Immanuel · 2026-02-10 12:31 · 663480cdd1c6c4231aef1d6c51ca6edbef620f41

 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;