To create launchers follow the ensuing steps:
mainClass.monkey
file. SetupGame
method, add the left launcher by calling CreateLauncher
. Its x
position is 30
pixels and it has the A key as a trigger and 15
rockets to start with.Next CreateLauncher(30.0, KEY_A, 15)
x
position and S as the trigger key, but also specify that there are 15
rockets.CreateLauncher(cWidth - 30.0, KEY_S, 15)
You told the game to create two rocket launchers at the beginning of the game. Easy, isn't it? Creating those classes pays off now.