-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gamestate Loop #1515
Gamestate Loop #1515
Conversation
e5eecfd
to
8ead5c1
Compare
|
||
auto test_pos = std::make_shared<component::Position>(this->loop, pos, time); | ||
|
||
if (entity->has_component(component::component_t::MOVE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about this code?
if (entity->has_component(component::component_t::MOVE)) {
std::vector<coord::phys3_delta> positions = {
{0, 1, 0},
{1, 2, 0},
{2, 2, 0},
{3, 1, 0},
{3, 0, 0},
{2, -1, 0},
{1, -1, 0},
{0, 0, 0} // Assuming this is equivalent to pos
};
std::vector<int> angles = {
279,
225,
180,
135,
90,
45,
0,
315
};
for (int i = 0; i < positions.size(); i++) {
entity_pos->set_position(time + i + 1, pos + positions[i]);
entity_pos->set_angle(time + i + 1, coord::phys_angle_t::from_int(angles[i]));
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hey, thanks for checking out the code :D
Given that the current code is just test code and soon to be removed, it probably doesn't really matter how it looks. Your solution looks more maintainable though, so if this were an engine demo, it would be the better solution.
Implement the core components of the gamestate loop
GameEntity
Ability
std::string
instead ofutil::Path
GameEntity