Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Oct 6, 2024
1 parent e8707b8 commit 7e4fa79
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "rect.hpp"
#include "resourcemanager.hpp"
#include "soundmanager.hpp"
#include <cstdint>

using namespace framework;

Expand Down Expand Up @@ -156,6 +155,12 @@ void entity::set_action(const std::string_view action) noexcept {
_props.action = action;
}

void entity::unset_action() noexcept {
_props.action = std::string();
_props.frame = 0;
_props.last_frame = 0;
}

std::string entity::action() const noexcept {
return _props.action;
}
Expand Down
2 changes: 2 additions & 0 deletions src/entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class entity : public std::enable_shared_from_this<entity> {

void set_action(const std::string_view action) noexcept;

void unset_action() noexcept;

std::string action() const noexcept;

void set_visible(bool visible) noexcept;
Expand Down
1 change: 1 addition & 0 deletions src/scriptengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ void scriptengine::run() {
"on_mail", &entity::set_onmail,
"set_flip", &entity::set_flip,
"set_action", &entity::set_action,
"unset_action", &entity::unset_action,
"set_velocity", &entity::set_velocity,
"set_placement", &entity::set_placement);

Expand Down

0 comments on commit 7e4fa79

Please sign in to comment.