Basic simple animations where the enemies just move forward.
This commit is contained in:
parent
947ccbe180
commit
80a0f2ba75
9 changed files with 92 additions and 80 deletions
|
@ -4,6 +4,8 @@
|
|||
#include "config.hpp"
|
||||
#include "dinky_components.hpp"
|
||||
#include "point.hpp"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <SFML/Graphics/Rect.hpp>
|
||||
|
||||
namespace components {
|
||||
struct Player {
|
||||
|
@ -83,6 +85,23 @@ namespace components {
|
|||
string name;
|
||||
};
|
||||
|
||||
struct Animation {
|
||||
float scale = 0.0f;
|
||||
bool simple = true;
|
||||
int frames = 10;
|
||||
int current = 0;
|
||||
|
||||
void step(sf::Vector2f& scale_out, sf::IntRect& rect_out) {
|
||||
if(current < frames) {
|
||||
scale_out.x += scale;
|
||||
scale_out.y += scale;
|
||||
current++;
|
||||
}
|
||||
|
||||
(void) rect_out;
|
||||
}
|
||||
};
|
||||
|
||||
void configure(ComponentMap& component_map);
|
||||
|
||||
// these need to be here if you're using components::convert outside of components.cpp
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue