
上QQ阅读APP看书,第一时间看更新
Time for action — modifying the launcher class
To modify the launcher
class, follow the ensuing steps:
- Open the
launcherClass.monkey
file. - Modify the
Update
method and add aCreateRocket
call there. The parameters are the mouse coordinates and theX
position of the launcher.Method Update:Int() If KeyHit(triggerKey) And cRockets > 0 Then CreateRocket(MouseX(), MouseY(), Self.x ) cRockets -= 1
What just happened?
We have just activated the functionality that will create a rocket when you hit a trigger key.