Game Development Reference
In-Depth Information
Defining the Attributes
As in the previous chapters, attributes will play a great deal in your game
engineering.
ActiveBall attribute will be used to know if a ball is already active on the screen
and if so, prevents the user from spawning another ball in the game. To do this,
you will use a Boolean.
BrickCount will be used to know when the ball destroys the last brick. You will
set this integer attribute with the initial number of bricks on the screen. Then
everytime a brick is destroyed, you will decrement this integer.
TextToDisplay will be used to communication game information with the player.
Create the attributes as per Table 4-9.
Table 4-9. Attribute List
Attribute Name
Type
Initial Value
ActiveBall
Boolean
False
BrickCount
Integer
6
TextToDisplay
Text
Implementing the Rules and Behaviors
Actors, attributes, and tags are now all set. But no logic and interaction has
been implemented yet. The next steps will add the rules and behaviors that will
define the game logic for each of actors.
Ball Rules and Behaviors
In order to give the ball an initial movement when it is spawned you will use a
Change Velocity behavior.
Drag and drop a Change Velocity behavior into the actor and change the setting
to direction of random (70,110) relative to the scene at a speed of 300, as per
Figure 4-3.
 
Search WWH ::




Custom Search