Chocobreak Tutorial - Step 7
Step 7: The extra objects
Being obliged to press Alt+F4 to quit the game is not very practical. It would be nice, and much easier, if the game would end when we press one key, like ESCAPE. Well, this is very simple to do in Clickteam Fusion 2.5. We can make an event with a condition and an action, which we are now familiar with, to accomplish this.
The event we want to define is "When the user presses ESCAPE then Quit the game". First of all, lets enter the condition. As usual, click on the "New condition" line in the events editor. This opens the New condition dialog. Do you remember that we mentioned we would talk about the extra objects contained in the dialog box? Now is the time. Let's discover what these powerful objects are about.
By moving your mouse over the objects, locate the "The mouse pointer and keyboard" object.
As its name indicates, this object tests everything that touches the mouse and the keyboard. Right click on the object to open the conditions menu. If you inspect the options, you can see that you have at your disposal many options to test the keyboard and the mouse. Select the option "The keyboard" / "Upon pressing a key".
This should open a small dialog box, asking you to press a key. We want to test a press of the ESCAPE key, so press the ESCAPE key when you are prompted.
You should now see a new line in the event editor with your condition.
Our new condition to test the ESCAPE key is now defined. We have to define the action that will happen when the key is pressed. We want the action to end the game. Inspect the object bar in the top of the events editor, and find the "Storyboard controls" object.
The "Storyboard controls" object allow you to control the flow of the application. Locate the empty square below the "Storyboard controls" object in front of our new condition, and click with the right mouse button. This opens the actions menu for this object. You can see many options to control the flow of the application, but the one you want to choose right now is: "End the application".
Once the action is defined, launch your game, and press ESCAPE : the game quits automatically.
Here is the list of the system objects, and their functions:
The "Special" object. This object contains many actions and conditions to perform complex tasks in Clickteam Fusion 2.5. It will be more important to you as you become an advanced user.
"The "Speaker" object. Contains actions to play sounds and music, and conditions to know whether this or that sound, or music, is playing. You can also adjust volume, channels and much more.
The "Storyboard controls" object contains actions and conditions to regulate the flow of the application. Going from one frame to the other, quitting the application, etc.
The "Timer" object contains conditions to perform actions at specific moments in the application.
The "New objects" object allows you to create new objects, (duplicates) of objects already in your application, while your application is running. A single monster could become ten or more this way.
The "Mouse pointer and Keyboard" object contains all the necessary conditions to test the mouse and the keys pressed.
The "Player 1" object contains actions to change the score and the number of lives of the player. It is used in games.
Spread the word!
You can share this document using the following buttons.