Game Development Reference
In-Depth Information
Go ahead and click on Add action next to On any click , and then select Spawn another
object . This is shown in the following screenshot. The object we want to spawn is a pro-
jectile.
Once you have clicked on the projectile, the following dialog box should appear:
Go ahead and test your game. You should be able to move around and shoot a projectile to
the mouse location.
Tip
We have to take into account that every time you spawn a projectile, it uses a little bit of
memory. Therefore, we have to destroy that projectile when we don't see it. If we do not
do this, then the game can lag; this is especially a problem for mobile devices.
Click on your projectile and click on Add behavior . Add the Destroy outside layout be-
havior. This will destroy the projectile and free up memory when the projectile is off-
screen. The Behaviors window should now look like the following screenshot:
Search WWH ::




Custom Search