1 #include "gamecontroller.h"
3 #include <msp/game/root.h>
4 #include <msp/game/transform.h>
9 GameController::GameController(Game::Stage &s):
11 asteroid_setup{ .physical = { .body = { .mass = 200 }, .collider = { .type = ColliderType::CIRCLE, .radius = 3.0f } },
12 .mesh = { .object_name = "Asteroid 1.object" }}
15 void GameController::tick(Time::TimeDelta)
21 uniform_real_distribution<float> sdist(-1, 1);
22 for(unsigned i=0; i<level+2; ++i)
24 asteroids.emplace_back(stage.get_root(), asteroid_setup);
25 asteroids.back()->get_transform()->set_position({ sdist(rng)*32, sdist(rng)*18, 0.0f });
26 asteroids.back()->get_body()->set_velocity(asteroids.back()->get_transform()->get_position().slice<2>(0)*-0.1f);
34 throw logic_error("Unimplemented state");