Now that we have successfully used the built-in physics engine to detect the collision, let us play a little bit with gravity. Go to the
createScene method and modify the parameters that we have sent to the constructor. In our game, we have used the
(0,0) value, since we did not want our world to have any gravity force that moves our bodies on either the x or the y axis.
Now, give it a try, change the values to positive or negative. When we use a negative value on the x axis, it will attract the body toward the left, and when we use the negative value on the y axis, it will attract the body toward the bottom.
Changing these values and understanding the physics added to our game might give you some ideas for your next games. ...