mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-21 22:05:10 +00:00
basic gravity
This commit is contained in:
21
sources/System/Gravity/GravitySystem.cpp
Normal file
21
sources/System/Gravity/GravitySystem.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Created by Tom Augier on 2021-06-09.
|
||||
//
|
||||
|
||||
#include "GravitySystem.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
GravitySystem::GravitySystem(WAL::Wal &wal)
|
||||
: System(wal)
|
||||
{}
|
||||
|
||||
void GravitySystem::onFixedUpdate(WAL::ViewEntity<GravityComponent, MovableComponent, PositionComponent> &entity)
|
||||
{
|
||||
auto &movable = entity.get<MovableComponent>();
|
||||
auto &position = entity.get<PositionComponent>();
|
||||
|
||||
if (position.getY() > 0)
|
||||
movable.addForce(Vector3f(0, -0.5, 0));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user