change to physics based ship movement

This commit is contained in:
2026-05-19 21:53:55 +02:00
parent d397b9969a
commit 34c6dea505
10 changed files with 183 additions and 44 deletions

View File

@@ -77,7 +77,7 @@ TEST_CASE("ShipSystem: interceptor level 5 hp matches formula", "[ship]")
REQUIRE(ship->maxHp == Approx(65.0f));
}
TEST_CASE("ShipSystem: interceptor level 0 speedPerTick matches formula / kTickRateHz", "[ship]")
TEST_CASE("ShipSystem: interceptor level 0 maxSpeedPerTick matches formula / kTickRateHz", "[ship]")
{
const GameConfig cfg = loadConfig();
EntityId nextId = 1;
@@ -86,9 +86,9 @@ TEST_CASE("ShipSystem: interceptor level 0 speedPerTick matches formula / kTickR
const EntityId id = ss.spawn("interceptor", 0, QVector2D(0.0f, 0.0f));
const Ship* ship = ss.findShip(id);
// speed_formula = "200 + 5*x" at x=0 → 200; speedPerTick = 200/30
// speed_formula = "200 + 5*x" at x=0 → 200; maxSpeedPerTick = 200/30
const float expected = 200.0f / static_cast<float>(kTickRateHz);
REQUIRE(ship->speedPerTick == Approx(expected));
REQUIRE(ship->maxSpeedPerTick == Approx(expected));
}
// ---------------------------------------------------------------------------