The OnUpdate
event is the place to update all game objects and control the flow of the game in general. You do everything in the method line-by-line and with hundreds of statements. However, we took the approach with building a lot of helper methods, which will now be called inside this method:
1. Inside the
OnUpdate
method, store the result of a call to the methodGetDeltaTime
in the local variabled
.Method OnUpdate:Int() Local d:Int = GetDeltaTime()
2. Check with an
If
statement, whether the fieldisSuspended
isFALSE
.If isSuspended = False Then
3. Add a
Select
statement with the fieldgameMode
. Then, insert theCase
statement for the constantgmPlay
.Select gameMode Case gmPlay
4. Now, call the
Update
method of your engine instance. As a speed parameter, we use the locald
variable divided by60
. The speed parameter is aFLOAT
value so you need to castd
toFLOAT
.eng.Update(Float(d)/60.0)
5. Now, check whether a
TouchHit
for the first...