Game Development Reference
In-Depth Information
5. Switch to Layer 2 and select the bullet. Add Always as the sensor, add And as the
controller, and Moion as the actuator. Change the X value to 5, or any other value
(depends on you) as shown in the next screenshot. Connect them. Select Layer 1
and press P to see the result.
What just happened?
We have already seen how to create the appearance of objects and interacion with our
character. The common factor in many games is to give the character weapons and bullets
to shoot, so we have learned through a second layer that we can add a constant object to
our main stage such as a bullet in a shooter game.
We inserted an empty object in our scene, which we have related to the character or main
enemy. We switched layers to model a prototype bullet with a simple cube having a constant
movement in one axis. Finally, we built the logic bricks that act every ime you press the
space bar.
Search Nedrilad ::

Custom Search