llevat soport per a colors amb nom

This commit is contained in:
2026-04-06 09:14:36 +02:00
parent c4a26ffa0f
commit cdf0665458
121 changed files with 676 additions and 5754 deletions

View File

@@ -6,12 +6,11 @@
#include "core/rendering/sprite/animated_sprite.hpp" // Para SAnimatedSprite
#include "core/resources/resource_cache.hpp" // Para Resource
#include "utils/utils.hpp" // Para stringToColor
#include "utils/utils.hpp"
// Constructor
Enemy::Enemy(const Data& enemy)
: sprite_(std::make_shared<AnimatedSprite>(Resource::Cache::get()->getAnimationData(enemy.animation_path))),
color_string_(enemy.color),
x1_(enemy.x1),
x2_(enemy.x2),
y1_(enemy.y1),
@@ -30,7 +29,7 @@ Enemy::Enemy(const Data& enemy)
collider_ = getRect();
color_ = stringToColor(color_string_);
color_ = enemy.color;
// Coloca un frame al azar o el designado
sprite_->setCurrentAnimationFrame((enemy.frame == -1) ? (rand() % sprite_->getCurrentAnimationSize()) : enemy.frame);