]> git.tdb.fi Git - libs/game.git/blobdiff - examples/bassteroids/source/playercontroller.cpp
Defer creation of bullets until the end of the frame
[libs/game.git] / examples / bassteroids / source / playercontroller.cpp
index 46f9c1f85e30dfe710c96411a041c73455b22029..cd0c62bad8594b77d0557a299cb964e71b3ef514 100644 (file)
@@ -51,7 +51,7 @@ void PlayerController::tick(Time::TimeDelta dt)
                body->add_torque(angular_vel.radians()*-min(angular_speed.radians()+setup.turn_rate/angular_speed.radians(), 1.0f/dt_secs));
 
        if(controls->fire.was_pressed())
-               fire();
+               defer([this]{ fire(); });
 
        controls->reset_edges();
 }