Group: Collisions
When we come in contact with an enemy, the game ends. So, which collisions should cause the game to end?
-obj_Propeller with obj_Girder and with obj_Hammer
-obj_Player with obj_Girder and with obj_Hammer (only when obj_Player is pinned to obj_Propeller)
We also want the game to end when obj_Propeller hits the left or right side of the screen. Since there is no object to collide with on the left or right side of the screen, we can use a comparison condition. You could use an object off the screen on the left and right side, but I find it unnecessary to add objects that will increase the object count.
The two orange objects used for collision detection. Always ask yourself if there is another way of doing something without having to add extra objects. Less objects is less memory usage.
These are the 5 events that will handle the collisions.
The actions needed for these events are the same for each event. So, instead of copying and pasting the same actions in each event, we will make a function with these actions and use the Call function for the action.
Click on the Functions tab. Add the event Function: On function and name it "PlayerHit". Go back to the Collision group and add the action Function: Call function "PlayerHit". Do this for each event.
We will add the actions for On function "PlayerHit" in the last part of this tutorial.