second commit
This commit is contained in:
+14
-14
@@ -1,14 +1,14 @@
|
||||
// src\movement.cpp
|
||||
#include <entt/entt.hpp>
|
||||
#include <components.hpp>
|
||||
|
||||
void update_movement_system(entt::registry& registry, float dt) {
|
||||
// We get Position and Velocity, but EXCLUDE entities that have the Player tag
|
||||
auto view = registry.view<Position, Velocity>();
|
||||
|
||||
view.each([dt](Position &position, Velocity &velocity) {
|
||||
// This will only run for pipes, enemies, or particles!
|
||||
position.x += velocity.dx * dt;
|
||||
position.y += velocity.dy * dt;
|
||||
});
|
||||
}
|
||||
// src\movement.cpp
|
||||
#include <entt/entt.hpp>
|
||||
#include <components.hpp>
|
||||
|
||||
void update_movement_system(entt::registry& registry, float dt) {
|
||||
// We get Position and Velocity, but EXCLUDE entities that have the Player tag
|
||||
auto view = registry.view<Position, Velocity>();
|
||||
|
||||
view.each([dt](Position &position, Velocity &velocity) {
|
||||
// This will only run for pipes, enemies, or particles!
|
||||
position.x += velocity.dx * dt;
|
||||
position.y += velocity.dy * dt;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user