Chocobreak Tutorial - Step 4
Step 4: The ball
Every breakout game needs a ball. Now that we know how to add objects, lets drop one on our playfield.
Locate the object called "BallGolden" in the library. Then, using the method described in the previous chapter, drag it and drop it in the middle of the frame.
If you click "Run Frame" now, you will see that the ball does not move. It is static. Why doesn't it move? It won't move until we teach our ball how to move, in other words, we are going to assign the ball movement property to our ball and define how that movement will work in our game.
Each object has a number of properties that define its behavior during the game. That is, how it moves, how it is displayed, its animations etc. To access the properties of an object, you just need to open its properties in the property window. This is done by simply clicking on the object in the frame : do it, and you will see the properties in the property toolbar.
The properties are sorted by genre, with little tabs in the top of the window. Locate the one called "Movement" and click on it.
Locate the line "Type", and click on it. This opens a combo box displaying all the different genres of movement. Select the "Bouncing ball" entry.
We have chosen to affect a "Bouncing ball" movement to our object. As you can see, other types of movements are available: we will come back on them later.
Once the movement is selected, its properties are available in the property toolbar.
If you explore all the different properties, you will notice some that are obvious, like the Speed property. By default the speed is set at 60, which is a little too fast for our game. Set the speed at 45 then click the "Try movement" button to see the speed of the ball on the screen.
Deceleration makes the ball slow down progressively, like in a football game. For our break out we do not want the ball to stop : leave this property at zero.
Moving at start should be checked : we want the ball to move when the game begins.
Number of angles indicates how many angle the ball can have. The different settings are 8, 16 and 32. Leave it to 32, it will make the game more interesting.
The Randomizer property, adds some randomness to the bounces : sometimes the ball will not bounce in the correct direction(s) if you set this too high. For this game, you may want to reduce this parameter a little.
The Security property is used to prevent a ball from getting stuck in a bouncing pattern loop, ( going back and forth the same way) it defines the number of times the ball will bounce before quitting the loop.
Note: After the tutorial, you can learn a lot and have some fun by experimenting with these settings and noting the effects they have.
Now click on the Initial direction property. As its name indicates, it defines the direction the ball will take when the game begins. As a default, the ball goes on the right of the screen. Of course we must modify this as we want the ball to come toward us, or better toward the bricks so that it bounces before coming to us. With your mouse select the arrows as below:
When more than one direction are selected, Clickteam Fusion 2.5 chooses a direction at random within the selected direction.
Congratulations! Great job. You have now taught your ball object how to move and it is ready to be a part of an enjoyable game. Now, let's move on to some more exciting aspects of our creation.
Spread the word!
You can share this document using the following buttons.