During the OnUpdate
method, we will do different things depending on the gameMode
field. If the mode is gmPlay
, we will update all objects and do collision checks. In other modes, we mostly check for certain keys that are hit on the keyboard to switch the game into a different mode.
1. Add a
Select
statement with thegameMode
field as a parameter.Method OnUpdate:Int() Local d:Float = Float(eng.CalcDeltaTime())/60.0 If isSuspended = False Then Select gameMode
2. Check against the
gmPlay
constant.Case gmPlay eng.Update(Float(d))
The call to the
Update
method of the engine is now part of thegmPlay
segment.3. Now, check for any collisions happening on the game layer. The response for this will be detailed inside the
engine
class.eng.CollisionCheck(layerGame)
4. Check if the Esc key was hit.
If KeyHit(KEY_ESCAPE) Then
5. If yes, activate the title screen and stop the plane engine sound.
layerTitle.SetActive(True) sndEngine.Stop()
6. Also, set the...