Files
snake-raylib-prototype/src/movement.cpp
T
2026-07-09 12:30:40 +01:00

15 lines
504 B
C++

// 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;
});
}