Chocobreak Tutorial - Step 10
Step 10: Score, lives and other objects
The score is an important part of any game : it tells how good a player is. Its a reward and a sign of accomplishment. Our breakout-style game should have a score so that the player can earn points for destroying blocks. This is part of making a game fun and challenging.
We also need to display the number of lives the player has. Without limited lives, the game would be far too easy and our player would get bored. In breakout games, the player usually loses a life when they miss the ball. So, that will be our condition for taking away one life.
Part of the fun of creating a game is making decisions. We have to decide how many points to award the player and how many lives the player should start with. Let's add some more fun and challenges to the game now:
Lets go back to the frame editor (click on the icon in the tool bar).
We are going to discover some more new objects. The objects we have been using so far (the ball, the bricks, the sugar bars) are called Active Objects. Active objects are the most used objects in a game : they can move, collide, and they can be animated. There are many more objects available in Clickteam Fusion 2.5, and they have different properties. Clickteam Fusion 2.5 is easy, but that does not mean it's not flexible and powerful. So, let's discover a few new objects and see what they can help us accomplish!
The Quick backdrop object
In the library, locate the object call "Sky". Drag and drop it onto the frame. As you can see, this object is a gradient of blue and looks very nice on our playfield. You also notice that this object goes in the background , behind all other objects automatically : it is called a Quick Backdrop object. Quick backdrop objects are simple colored backgrounds. They do not have many properties, they cannot be moved, and they do not interfere at all with the active objects. They are just here as a backdrop, to enhance the display. They can be set to an ellipse shape or a line, and you can define a colored border for them.
Click on the sky object to select it, immediately its properties appear in the property toolbar. As you can see, there are many properties for you to change : do not hesitate to have a go. If you mess up your sky object, you'll only have to destroy it, and retake one from the library.
The Score object
We need an object to display the score. Clickteam Fusion 2.5 provides one object dedicated to do this : the Score object. We will not find the score object in the library (it could reside there, we simply did not insert it), but we are going to create a score object from scratch.
Open the "Insert" menu in the top menu bar, and choose the option "New object".
It opens a dialog box with a list of objects. These are all the available objects in Clickteam Fusion 2.5 : as you can see, there are many, and they are what give Clickteam Fusion 2.5 the power to do what you want.. In the left pane of the window, click on the name "Game" : this will display only the game objects in the right pane.Locate the Score object in the list, and double click on it.
This closes the box. Your mouse pointer, displayed as a cross, is now carrying the object, click somewhere in the bottom of the play area. Your object is now dropped. If you look in the property toolbar, you can see that the player affected to this score object is player 1. Now drag the number to a convenient location in the bottom left of the play area: this will display our score.
The Lives objects
We need to display the number of lives for the player during the game. For that we will use a Lives object. As before, we are going to create this object from scratch as it does not exist in the library.
As for the score object, choose the "Insert" / "New object" option in the main menu. Click on "Games" and locate the Lives object in the list. Double click on it in the box, and then click somewhere in the play area. Then dispose your Lives object in the bottom right corner of the play area.
Others objects
As you can see in the object selection dialog, Clickteam Fusion 2.5 contains a large number of ready-to-use objects. Let's describe some of these objects:
The Quick Backdrop object : we have used the sky object which is a quick backdrop object. Useful objects to create a color zone that does not interfere with the game. Quick backdrop objects have very little properties, they cannot move. | |
The Backdrop object : a simple image in the background, that does not interfere with the action. Just like the quick backdrop object, it don't move, and it lies behind all other objects. The difference is that this object can display a picture of your choosing, rather than a simple color or gradient. | |
The Active object : certainly the most widely used of all the objects - and very powerful! It can contain pictures, animations, and directions, it can be moved, and reacts to, and interacts with, the other objects. This is the object of choice for your games! | |
The Counter object : as its name indicates, this object holds numerical values and, at your option, displays it on the frame. The value can be displayed as a number, or as a percentage bar, either horizontal or vertical. This object is very useful for complex applications where you need to store data. You can add to, subtract from, and set a counter. Tip : In the counter's properties, you can set the starting value, as well as the highest and lowest numbers it will be able to work with. It is very important to use these settings for percentage bars or you may not see them do anything at all when running your application. | |
The String object : this object holds text, also known as a string, and can display it on the screen. You can choose the font, and align the text, (left, center, right) as you wish. But more than that, the string object allow you to do some string manipulations and calculations. As you advance you will find this easy to understand and very powerful. | |
The Quick Backdrop object : we have used the sky object which is a quick backdrop object. Useful objects to create a color zone that does not interfere with the game. Quick backdrop objects have very little properties, they cannot move. | |
The Lives object : displays the number of lives remaining for the player. It can display it as individual drawings, or as a number. | |
The Hi-Score object : automatically displays and manages a table of high scores for your game. | |
The Button object : this object displays a Windows' style button, a checkbox or a radio button. Very useful when you have to create interfaces. Buttons let your user/player control things. |
Spread the word!
You can share this document using the following buttons.