55 Create Mushroom Animations (Import from sprite strip)
Flip all Frames so the Mushroom looks right
Recommended Mushroom size is 60 x 60
Run animation is looped at 20fps
Hit animation is not looped.
56 Add event sheet for Mushroom
57 Add Platform Behaviour to Mushroom
58 Code the Mushroom Event Sheet
Walk in direction you are facing
Determine which direction to face
The 'offset' variant will test for an overlap at an offset (distance / amount) from the first object.
For example, testing for an overlap at an offset of (100, 0) will temporarily move the object to the right 100 pixels, test for the overlap, then move it back again.
Right click the overlapping coding block and set it to not overlapping
1 / CREATED THE PLAYERCONTROLLER (Yellow Box) and add Platform behaviour and enable double jump RETURN TO THIS SECTION AFTER DOING SO
2/ In the equation below (if the collision does not work) divide Mushroom.height by 8 instead of 2 . Make sure the playerbox is same height as mushroom.
Note: Divide is actually / (forward slash) Construct will replace it with the divide sign ( ÷ )afterwards.
Player Collision Code Explained:
A loop runs FOR EACH mushroom in the layout.
When the mushroom collides with the player:
IF the player is ABOVE the mushroom AND the player is falling down
Allow the player to double jump if they try to
61 If you want it to be easier to kill the mushrooms when colliding change the collision code to:
62 Use this image for the Dead Mushroom (right click and save as)
63 Put the Dead Mushroom Sprite in the Temp Layout
Add the Platform Behaviour
64 Modify your Collision Code
Mushrooms cannot hurt the player yet.
We will return to this later...