For this, we need to detail the OnLayerTransition
method of the engine
class, as follows:
1. First, we check if the transition ID is equal to
g.tidNextLevel
.Method OnLayerTransition:Int(transId:Int, obj:ftLayer) If transId = g.tidNextLevel Then
2. Then, reset the alpha value of the layer back to
1.0
. That means it would be fully visible.g.layerGame.SetAlpha(1.0)
3. Next, check whether the current level number is smaller than
4
(we have only four levels).If g.levelNum < 4 Then
4. Raise the current level number and load a new level.
g.levelNum+=1 g.LoadLevel()
5. Switch the game mode back to
g.gmPlay
.g.gameMode = g.gmPlay
6. If the last level is already reached, activate the title layer.
Else g.layerTitle.SetActive(True)
7. Set the game mode to
g.gmMenu
and close off the twoIf
checks.g.gameMode = g.gmMenu Endif Endif Return 0 End