diff options
| author | Elizabeth Hunt <me@liz.coffee> | 2025-10-26 17:25:13 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <me@liz.coffee> | 2025-10-26 17:25:13 -0700 |
| commit | 395aa7d1c312e495517701be11c21425d9a5838e (patch) | |
| tree | 4ad184b082838c56149cc1d1efe191cfd3d0679b /composeApp/src/commonMain/kotlin/coffee/liz/ecs/physics/IntegrationTick.kt | |
| parent | 64f825465de9fa30c4dfe2707067efdb96110db8 (diff) | |
| download | abstraction-engine-kt-395aa7d1c312e495517701be11c21425d9a5838e.tar.gz abstraction-engine-kt-395aa7d1c312e495517701be11c21425d9a5838e.zip | |
Checkpoint
Diffstat (limited to 'composeApp/src/commonMain/kotlin/coffee/liz/ecs/physics/IntegrationTick.kt')
| -rw-r--r-- | composeApp/src/commonMain/kotlin/coffee/liz/ecs/physics/IntegrationTick.kt | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/composeApp/src/commonMain/kotlin/coffee/liz/ecs/physics/IntegrationTick.kt b/composeApp/src/commonMain/kotlin/coffee/liz/ecs/physics/IntegrationTick.kt new file mode 100644 index 0000000..03af835 --- /dev/null +++ b/composeApp/src/commonMain/kotlin/coffee/liz/ecs/physics/IntegrationTick.kt @@ -0,0 +1,27 @@ +package coffee.liz.ecs.physics + +import coffee.liz.ecs.World + +internal class IntegrationTick<Outside> { + fun runTick(world: World<Outside>) { + world.query(Velocity::class, Acceleration::class).forEach { entity -> + val velocity = entity.get(Velocity::class) + val acceleration = entity.get(Acceleration::class) + entity.add( + Velocity( + vec2 = velocity.vec2.plus(acceleration.vec2) + ) + ) + } + + world.query(Position::class, Velocity::class).forEach { entity -> + val position = entity.get(Position::class) + val velocity = entity.get(Acceleration::class) + entity.add( + Position( + vec2 = position.vec2.plus(velocity.vec2) + ) + ) + } + } +}
\ No newline at end of file |
