Warning: mysqli_connect(): (HY000/1045): Access denied for user 'xableu5_tutorial'@'localhost' (using password: YES) in /home/xableu5/fusion.xable.info/tutorialAutoUpdate.php on line 14

Warning: mysqli_query() expects parameter 1 to be mysqli, boolean given in /home/xableu5/fusion.xable.info/tutorialAutoUpdate.php on line 18

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/xableu5/fusion.xable.info/tutorialAutoUpdate.php on line 20

Warning: mysqli_close() expects parameter 1 to be mysqli, boolean given in /home/xableu5/fusion.xable.info/tutorialAutoUpdate.php on line 25
Go to content

Main menu:

How to Pause a Multimedia Fusion 2 and Clickteam Fusion Application by Clicking an Icon

Last Updated: December 9th, 2013
Ahh pausing. One of game's original mechanics since the days of the arcade. Although it might seem complicated initially, pausing an application is one of easiest things within MMFusion.

Quick Links:
Part 1
First, create the active object that represents the icon and insert a counter into the frame. Rename the active object to "Pause/Resume Game Object" 

Now head over to the Event Editor.

The usage of groups makes up the premise behind this tutorial. Why groups? Groups can add tremendous organization to your code. You can label different sections of code different names and enable/disable these different sections at different times, as demonstrated in this tutorial.

So back at the Event Editor, create a new group called "Main Code". Within this group add the following line of code:


  • Always

  • Add '1' to Counter Object


Now make another group called "Pause/Resume Code" outside of the "Main Code" (Pause/Resume Code should not be within Main Code).

Within "Pause/Resume Game" add:

  • User Clicks on "Pause/Resume Game Object"

  • Only one action when event loops

  • Toggle Flag '0' of "Pause/Resume Game Object"


When you toggle a flag, you simply switch its state either from off to on, or on to off.

Now two lines of code need insertion, both under the group "Pause/Resume Code."

The first line

  • "Pause/Resume Game Object" Flag '0' is 'ON'

  • Only one action when event loops

  • Disable Group "Main Code"

  • Change Animation of "Pause/Resume Game Object" to (the other animation sequence within the Pause/Resume Game Object)


You may want to loop the secondary animation of the "Pause/Resume Game Object" so that it does not go back to the stopped animation when/if the secondary animation stops

The second line:

  • "Pause/Resume Game Object Flag '0' is 'OFF'

  • Only one action when event loops

  • Enable Group "Main Code"

  • Change Animation of "Pause/Resume Game Object" to "Stopped" (or the first animation for this object)

Introduction

If all worked out well, then whenever you click the "Pause/Resume Game Object" the counter will either pause or resume incrementation. Why does this work?

When a group is disabled, MMFusion skips over the group and all internal sub-groups. As such, when you click on the "Pause/Resume Game Object" and the game is paused, the counter will increment again because the "Main Code" group will be re-enabled.

With this in mind, pre-built code such as the default movements and animations will continue even when the "Main Code" group is disabled. 
You will need to use alternative actions in the Event Editor to pause these code snippets.

Conclusion

What you'll need:

  • One Active Object with Bouncing Ball Movement


Initally, just create a new active object and give it the Bouncing Ball Movement (give the ball a slow speed). Then try to pause the game. Notice how the ball continues to move even though the game is "paused". This is because the code for the Bouncing Ball Movement is internalized. In order to get the Bouncing Ball Movement (and other default movements) to pause when the "Main Code" pauses, you will have to do one of two things when you disabled "Main Code"

  1. Pause the actual movement
  2. Set the movement speed to 0 

Either of these will work though some default movements do not have a movement speed whilst others do not have the "pause" command. Nevertheless in most cases, one of these options will work.

When you resume the game
(Mouse Clicks on "Pause/Resume Game Object"), either:

1. Resume the actual movement

or
2. Reset the movement speed to 0

This solves a large portion of default movement problems. Another evident problem lies within animations. By default, animations are handled outside of the Event Editor. So when you pause the game, every/most object's animation will continue. This undesired behavior can be remedied however.

Simply add each object to a qualifier. Then execute the action "
Stop Animation" when the game pauses. When the game resumes, execute "Start Animation".

Now you can successfully pause an application through the use of group activation and group deactivation.


Rate This Tutorial
Vote: 5.0/5
If you have read this tutorial, rate it from poor (1) to average (3) to great (5)!
Back to content | Back to main menu