/* Overridden GameAction to ensure that objects use the modified time */ void BouncingBallMain::GameAction() { // If too early to act then do nothing if ( !TimeToAct() ) return; // Don't act for another 10 ticks SetTimeToAct( 1 ); UpdateAllObjects( GetTime() ); }
/* Overridden GameAction which can be modified */ void MyProjectMain::GameAction() { // If too early to act then do nothing if ( !TimeToAct() ) return; // Don't act for another 10 ticks SetTimeToAct( 1 ); // Tell all objects to update themselves UpdateAllObjects( GetTime() ); }
/* Sub-class should actually do something, if relevant e.g. move the player or any other sprites */ void BaseEngine::GameAction() { // If too early to act then do nothing if ( !TimeToAct() ) return; // Don't act for another 10 ticks SetTimeToAct( 10 ); // Tell all objects to update themselves. // If they need the screen to redraw then they should say so, so that GameRender() will // call the relevant function later. UpdateAllObjects( GetTime() ); }
/* Overridden GameAction to ensure that objects use the modified time */ void Demo4Main::GameAction() { // If too early to act then do nothing if ( !TimeToAct() ) return; // Don't act for another 10 ticks SetTimeToAct( 1 ); // NEW SWITCH switch( m_state ) { case stateInit: case statePaused: break; case stateMain: // Only tell objects to move when not paused etc UpdateAllObjects( GetTime() ); break; } }