forked from NTUT-FUCK-PTSD/Fuck-PTSD
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
197 additions
and
29 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Created by adven on 2024/5/2. | ||
// | ||
|
||
#ifndef FUCK_PTSD_SPEAR_H | ||
#define FUCK_PTSD_SPEAR_H | ||
#include "Game/Warehouse/IEquip.h" | ||
|
||
class Spear : public IEquip { | ||
public: | ||
explicit Spear(); | ||
~Spear() = default; | ||
|
||
void SetPosition(const glm::vec2& Position) override; | ||
|
||
[[nodiscard]] | ||
Pos GetWinPos() const override { | ||
return Pos::ROW; | ||
} | ||
|
||
[[nodiscard]] | ||
std::string GetName() const override { | ||
return "WEAPON"; | ||
}; | ||
|
||
[[nodiscard]] | ||
std::string GetType() const override { | ||
return "Spear"; | ||
} | ||
|
||
private: | ||
void GenSlot(); | ||
void GenItem(); | ||
}; | ||
|
||
#endif // FUCK_PTSD_SPEAR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// Created by adven on 2024/5/2. | ||
// | ||
|
||
#include "Game/Warehouse/Spear.h" | ||
#include "Player_config.h" | ||
#include "Settings/Helper.hpp" | ||
|
||
Spear::Spear() { | ||
GenItem(); | ||
GenSlot(); | ||
|
||
SetVisible(false); | ||
} | ||
|
||
void Spear::SetPosition(const glm::vec2& Position) { | ||
m_Transform.translation = Position; | ||
|
||
const auto& list = GetChildren(); | ||
list[0]->m_Transform.translation = Position + glm::vec2{0, -5}; | ||
list[1]->m_Transform.translation = Position + glm::vec2{0, 0.4}; | ||
} | ||
|
||
void Spear::GenItem() { | ||
const auto& obj = std::make_shared<Util::GameElement>(); | ||
const auto& size = Settings::Helper::CountImgPixel( | ||
Players::Config::IMAGE_SPEAR.data(), | ||
1, | ||
2 | ||
); | ||
const auto& item = std::make_shared<SpriteSheet>( | ||
Players::Config::IMAGE_SPEAR.data(), | ||
size, | ||
std::vector<std::size_t>{0}, | ||
false, | ||
100, | ||
true, | ||
100 | ||
); | ||
|
||
obj->SetDrawable(item); | ||
obj->SetZIndex(Players::Config::VAL_ZINDEX); | ||
obj->SetScale(Players::Config::VAL_SCALE); | ||
obj->SetPosition(Players::Config::VAL_INITPOS); | ||
|
||
AddChild(obj); | ||
} | ||
|
||
void Spear::GenSlot() { | ||
const auto& obj = std::make_shared<Util::GameElement>(); | ||
const auto& slot = std::make_shared<Util::SpriteSheet>( | ||
Players::Config::IMAGE_SLOT_ATTACK.data() | ||
); | ||
|
||
slot->SetDrawRect(SDL_Rect{0, 0, 30, 33}); | ||
obj->SetDrawable(slot); | ||
obj->SetZIndex(Players::Config::VAL_ZINDEX); | ||
obj->SetPosition(Players::Config::VAL_INITPOS); | ||
obj->SetScale(Players::Config::VAL_SCALE); | ||
|
||
AddChild(obj); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters