1. The new method will be called
ActivateShield
.Method ActivateShield:Int()
The shield object is already created, so we just want to make it active. As we want it to be deactivated after 5 seconds, we need to create a timer to do this.
2. Create a new object timer. The parameters are the shield object, the timer ID
tmShieldTime
, and when it should fire (in5000
milliseconds).eng.CreateObjTimer(g.shield, g.tmShieldTime, 5000)
3. While the shield is active, the player ship should not take any collisions.
g.player.SetColGroup(0)
4. Set the shield to active and close the method.
g.shield.SetActive(True) Return 0 End
The last method you have created will activate the shield of the player ship and create the timer that will deactivate the shield when it fires.