The game file to import and load for this session is 5961_03_10.stencyl
.
We'll start by setting up the banana actor as a sensor:
We have changed the banana actor into a sensor; our game will still detect collisions between the banana and the monkey and cause a collision event, but the collision will not cause a physical reaction in the game. It's important to note that, because the banana has two collision shapes (two circles), we had to configure both of those shapes as sensors.
Because the banana is now a sensor, we also needed to change a physics setting so that it will no longer be affected by the scene's gravity. If we do not tell sensors to ignore gravity, they will fall straight through the tiles!
Don't these changes put us right back where we started? Before we created the Collectible collision group, the monkey ran straight through the banana actor, and that's what's happening now!
Although it looks like we have taken a step backwards, behind the scenes Stencyl is still detecting the collision, but instead of making the monkey bump into the banana actor, it is just sensing when the collision occurs and creating a collision event. This means that we can use or create behaviors that depend upon a collision being sensed between the monkey and the banana actors, and that's exactly what we need in our game!
The game file to import and load for this session is 5961_03_11.stencyl
.
We have only configured the banana to be a sensor, but we also have grapes, a melon, and a pineapple, which should also be configured in the same way, so go ahead and configure each of the fruit actors as sensors. Remember to change each actor's Affected by Gravity? setting to No so the actors don't fall through the tiles.
When this task has been completed, our monkey should be able to run through each piece of fruit without bumping into it!
3.143.229.85