add SpriteInstruction class

This commit is contained in:
scawful
2024-08-07 16:10:50 -04:00
parent 8234dbc218
commit 6d65b65cdc
2 changed files with 83 additions and 0 deletions

View File

@@ -90,6 +90,64 @@ SpriteAction& SpriteAction::SetNextAction(const std::string& nextActionName) {
std::string SpriteAction::GetConfiguration() const { return ""; } std::string SpriteAction::GetConfiguration() const { return ""; }
// ============================================================================
SpriteInstruction SpriteInstruction::PlayAnimation(int startFrame, int endFrame,
int speed) {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::ApplySpeedTowardsPlayer(int speed) {
SpriteInstruction instruction;
instruction.SetConfiguration("JSL Sprite_ApplySpeedTowardsPlayer");
return instruction;
}
SpriteInstruction SpriteInstruction::CheckDamageFromPlayer() {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::MoveXyz() {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::BounceFromTileCollision() {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::SetTimer(int timerId, int value) {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::Custom(const std::string& asmCode) {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::BehaveAsBarrier() {
SpriteInstruction instruction;
return instruction;
}
SpriteInstruction SpriteInstruction::JumpToFunction(
const std::string& functionName) {
SpriteInstruction instruction;
return instruction;
}
} // namespace zelda3 } // namespace zelda3
} // namespace app } // namespace app
} // namespace yaze } // namespace yaze

View File

@@ -8,6 +8,31 @@ namespace yaze {
namespace app { namespace app {
namespace zelda3 { namespace zelda3 {
class SpriteInstruction {
public:
// Predefined instructions
static SpriteInstruction PlayAnimation(int startFrame, int endFrame,
int speed);
static SpriteInstruction ApplySpeedTowardsPlayer(int speed);
static SpriteInstruction CheckDamageFromPlayer();
static SpriteInstruction MoveXyz();
static SpriteInstruction BounceFromTileCollision();
static SpriteInstruction SetTimer(int timerId, int value);
static SpriteInstruction BehaveAsBarrier();
static SpriteInstruction JumpToFunction(const std::string& functionName);
// Custom instruction
static SpriteInstruction Custom(const std::string& asmCode);
// Get the instruction configuration
std::string GetConfiguration() const { return instruction_; }
void SetConfiguration(const std::string& instruction) {
instruction_ = instruction;
}
private:
std::string instruction_;
};
class SpriteAction { class SpriteAction {
public: public: