Im making a spaceship battle arena game and i need to call the fire function while my key is down. How can i do it?
Set flag isShooting to false.
Change it to true on this method: KeyboardTest::onKeyPressed
Change it to false on this method: KeyboardTest::onKeyReleased
Keep shooting while isShooting is true.
(You can use schedule for continue shooting.)
Is this->schedule(SCHEDULE_SEL(&MY_FUNCTION)); the right way to schedule a function?
Probably not. I recommand using schedule(schedule_selector(MyClass::myFunction), 0.f)
or schedule([this](float dt){ myFunction(dt); }, 0.f, "myFunction")
. myFunction
must accept a float as parameter in the former.