HC-06: rutes d'assets de GameScene a Defaults::Pyramid + Config
Afegits `Defaults::Pyramid::{MAP_YAML, PLAYER_SPRITE, PLAYER_YAML,
MUSIC_TRACK}` a utils/defaults.hpp. `GameScene` exposa `Config` i
`defaultConfig()`; el ctor accepta Config (default = Defaults::Pyramid)
i usa els camps enlloc dels literals. `Player` passa a rebre el anim_key
per constructor en lloc de cablejar "player.yaml". Cache key = basename
(convenció preexistent). Cada piràmide futura serà un Config distint.
This commit is contained in:
1 parent
e84d8cc535
commit
505e819af1
6 files changed
+60
-20
No files matched your search
@@ -45,8 +45,8 @@ void Player::loadFrom(const std::string& yaml_path) {
|
||||
collision_y_offset = (sprite_h - base_size) - collision_padding;
|
||||
}
|
||||
|
||||
Player::Player(float x, float y, const Controls& controls)
|
||||
: AnimatedSprite(Resource::Cache::get().getAnimationData("player.yaml")),
|
||||
Player::Player(const std::string& anim_key, float x, float y, const Controls& controls)
|
||||
: AnimatedSprite(Resource::Cache::get().getAnimationData(anim_key)),
|
||||
controls_(controls) {
|
||||
setPos(x, y);
|
||||
setCurrentAnimation("stand");
|
||||
|
||||
Reference in new issue
Block a user