Create an event with the 3 conditions:
-System: Every X seconds, where seconds is 0.07
-obj_ScoreBoard Compare Y, where Y equals 365
-System: Compare variable, where ScoreCounter is not equal to Score
The actions for this event:
-System: Add to, where variable is Score and value is 1
-spf_ScoreBoard set text to variable ScoreCounter
-play coin sound
Create an event for when the user touches obj_Playbutton.
The actions for this event:
-play coin sound
-set all layers invisible (HUD, Foreground, Player, Enemies, Midground, and Background)
-wait 0.3 seconds
-System: Restart the layout
Create an event for when the user touches obj_BackButton.
The actions for this event:
-play coin sound
-set all layers invisible (HUD, Foreground, Player, Enemies, Midground, and Background)
-wait 0.3 seconds
-System: Go to layout Intro
The Functions Event sheet
The function On "PlayerHit" will be called when obj_Propeller or obj_Player collides with obj_Grider or obj_Hammer, or when obj_Propeller hits the left or right side of the screen.
The actions for the function:
-System: Set group active, deactivate the Player Controls group and the Vertical Down Scrolling group
-stop the fan sound
-play the crash and fun sound
-destroy obj_Propeller
-obj_Propeller spawns obj_LeftPropeller on the Enemies layer
-obj_LeftPropeller, set the angle of motion at a random number from 0 to 180
-obj_Propeller spawns obj_RightPropeller on the Enemies layer
-obj_RightPropeller, set the angle of motion to a random number from 0 to 180
-obj_Clouds, set angle of motion to 270 degrees
-obj_Clouds, set Bullet speed to 1000
-obj_Pipes, set angle of motion to 270 degrees
-obj_Pipes, set Bullet speed to 1000
-obj_Pipes, set Bullet behavior enabled
-obj_Ground, set angle of motion to 270 degrees
-obj_Ground, set Bullet speed to 1000
-obj_Ground, set Bullet behavior enabled
-obj_Girder, set angel of motion to 270 degrees
-obj_Girder, set Bullet speed to 1000
-obj_Hammer, set angel of motion to 270 degrees
-obj_Hammer, set Bullet speed to 1000
We will now rotate the player in the direction it was facing.
Create the first sub-event within the Function On "PlayerHit" which checks if obj_Player is facing to the right (not mirrored) and with the action obj_Player set rotation speed to 360 degrees.
Create the second sub-event which checks if obj_Player is facing to the left (mirrored) and with the action obj_Player set rotation speed to -360 degrees.
[page="
Clean Up"]
Clean Up
When I finish a project, I always check the events and actions one by one. I test the project over and over to get rid of any bugs, or anything that is redundant.
Here is an example, the Vertical Down Scrolling group.
The objects have the same conditions and actions. If we combine the obj_Ground actions with the obj_Pipes actions, we can delete the obj_Ground event. That's one event less, bringing our event count to 60.