Player has proper size and a better placeholder graphic
This commit is contained in:
parent
b3d793cb9f
commit
74ca505b60
6 changed files with 21 additions and 18 deletions
|
@ -56,8 +56,8 @@ set(SOURCES
|
|||
src/game/player/player_spawner.hpp
|
||||
src/game/camera/tracking_area.h
|
||||
src/game/camera/tracking_view_options.hpp
|
||||
src/game/collectables/environment_collectable.cpp
|
||||
src/game/collectables/environment_collectable.hpp
|
||||
src/game/collectables/collectable.cpp
|
||||
src/game/collectables/collectable.hpp
|
||||
src/sprites/texture_manager.cpp
|
||||
src/sprites/texture_manager.hpp
|
||||
src/sprites/sprite_sheet.cpp
|
||||
|
|
BIN
assets/hole.png
Normal file
BIN
assets/hole.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 313 KiB |
|
@ -20,7 +20,7 @@
|
|||
// Graphic settings
|
||||
#define ISOMETRIC_SKEW 0.3f
|
||||
#define MOVEMENT_SKEW sf::Vector2f(1.f, 1/ISOMETRIC_SKEW/2.f)
|
||||
#define WORLD_TO_ISO_SCALE 50.0f // 50.f
|
||||
#define WORLD_TO_ISO_SCALE 50.0f // 50.f, don't change. Rather adjust the zoom of the camera
|
||||
|
||||
// Tracking view defaults
|
||||
#define DEF_TV_FREE_MOVE_THRESHOLD 0.f
|
||||
|
|
|
@ -12,9 +12,8 @@ Player::Player(std::shared_ptr<InputIdentity> assignedInput, const std::string &
|
|||
|
||||
input = std::move(assignedInput);
|
||||
|
||||
auto radiusInIso = getIsoRadius();
|
||||
auto sprite = std::make_shared<VersatileSprite>(skinRessourceName, sf::Vector2f{radiusInIso * 2.f, radiusInIso * 2.f});
|
||||
addChildScreenOffset(sprite, {-radiusInIso, -radiusInIso});
|
||||
auto sprite = std::make_shared<VersatileSprite>(skinRessourceName, getIsoSize());
|
||||
addChildScreenOffset(sprite, IsometricCoordinates(-getIsoSize() / 2.f));
|
||||
}
|
||||
|
||||
sf::Vector2f Player::getTrackablePosition() const
|
||||
|
@ -24,8 +23,7 @@ sf::Vector2f Player::getTrackablePosition() const
|
|||
|
||||
sf::Vector2f Player::getTrackableSize() const
|
||||
{
|
||||
auto isoRadius = getIsoRadius();
|
||||
return {isoRadius * 2.f, isoRadius * 2.f};
|
||||
return getIsoSize();
|
||||
}
|
||||
|
||||
void Player::update()
|
||||
|
@ -64,12 +62,15 @@ int Player::getPlayerId() const
|
|||
return playerId;
|
||||
}
|
||||
|
||||
float Player::getIsoRadius() const
|
||||
{
|
||||
return radiusInWorld * WORLD_TO_ISO_SCALE;
|
||||
}
|
||||
|
||||
float Player::getWorldRadius() const
|
||||
{
|
||||
return radiusInWorld;
|
||||
}
|
||||
|
||||
sf::Vector2f Player::getIsoSize() const
|
||||
{
|
||||
// TODO: For some reason, the player is a little to narrow. This fixes it.
|
||||
const float fixFactor = 1.4f;
|
||||
float width = radiusInWorld * 2.f * WORLD_TO_ISO_SCALE * fixFactor;
|
||||
return {width, width * ISOMETRIC_SKEW};
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
float speed = DEFAULT_PLAYER_SPEED;
|
||||
|
||||
sf::Vector2f getIsoSize() const;
|
||||
|
||||
int getPlayerId() const;
|
||||
|
||||
float getWorldRadius() const;
|
||||
|
@ -37,8 +39,6 @@ private:
|
|||
|
||||
int playerId;
|
||||
static inline int playerCreationCounter = 0;
|
||||
|
||||
float getIsoRadius() const;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "sprites/configs/sheet_config.hpp"
|
||||
#include "sprites/configs/sprite_config.hpp"
|
||||
|
||||
#define PLAYER_SKIN "ring"
|
||||
#define PLAYER_SKIN "hole"
|
||||
|
||||
/**
|
||||
* All textures used in the game.
|
||||
|
@ -17,7 +17,8 @@ std::map<std::string, std::string> const all_textures = {
|
|||
{"numbers", "assets/numbers.png"},
|
||||
{"64", "assets/64.png"},
|
||||
{"edge", "assets/edge.png"},
|
||||
{"ring", "assets/ring.png"}
|
||||
{"ring", "assets/ring.png"},
|
||||
{"hole", "assets/hole.png"}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,8 @@ std::map<std::string, AnimationConfig> const all_animations = {
|
|||
std::map<std::string, SpriteConfig> const all_sprites = {
|
||||
{"64", SpriteConfig("64")},
|
||||
{"edge", SpriteConfig("edge")},
|
||||
{"ring", SpriteConfig("ring")}
|
||||
{"ring", SpriteConfig("ring")},
|
||||
{"hole", SpriteConfig("hole")}
|
||||
};
|
||||
|
||||
#endif //HOLESOME_TEXTURE_CONFIG_H
|
||||
|
|
Loading…
Reference in a new issue