Title: Video Game Programming Level One
1Video Game ProgrammingLevel One Breakout
INSTRUCTOR Big Dan Teague TEACHERS
ASSISTANT Delmar O'Donnell
2PART 1 BRIX BASICS
- Objective
- Create the Splash Screen and have it display for
3 seconds before the Main Menu is displayed. - Step 1 Game Properties
- Step 2 Timer
- Step 3 Splash Screen
- Step 4 Save and Test
3CONCEPT File Formats
- A file format is the way data is encoded for
different types of files. - Some common file formats are .bmp, .gif, .txt,
.doc, .mp3 and .wav - Images in Fun are .bmp (Bitmaps) and sounds are
.wav (WAVE form audio format).
4STEP 1 Set Up the Game Properties
- Right-click on Game and select Properties.
- Select 640x480 in the Resolution menu.
- Select True Color (32 bit) from the Color
Bit-Mode. - Set the Compiler to the compiler currently
installed on the computer. - In the Window Title text box enter Brix (your
name). - Click OK.
5Step 2 Create the Timer Function
- Right-click Object Functions and Select Add.
- Enter MyTimer in the name box.
- Click on the Timer button and check the Activate
Timer box. - Set the timer for 3000 Milliseconds, select Run
Once at the bottom and then click OK. - Change Used By to Levels, then enter the
following code and save.
6MyTimer Code
myGame-gtLevelName("MainMenu")
7STEP 3 The Splash Screen
- Add The Level
- Right-click on the first level listed below Game
and select Rename. - Enter SplashScreen in the box that pops up and
then click on OK.
8MAP
- Set up the Map
- Expand the SplashScreen Level.
- Right-click on Maps and select Add.
- Enter Splash_Screen for the name.
- Browse for the map file and select
- Brix\Art Assets\Maps\Brix_Splash_Screen.bmp
- Now click OK to close the map properties window.
9LEVEL BEHAVIORS
- Set the Level Behaviors
- Right-click SplashScreen and select Properties.
- In the Level Properties window click on the
Behavior tab. - Add the MyTimer function to the list.
10STEP 4 Save and Test
- Save the Project
- Click on Project and Save.
- Run the Project
- Click on the Build/Run button in the menu bar.
- Results
- Splash screen should display.
11PART 2 BRIX MENUS
- Objective
- Create the Main Menu and detect mouse over
collisions and mouse click collisions with
buttons on the menu. - Step 1 Start and Exit Buttons
- Step 2 Cursor and Cursor Functions
- Step 3 Main Menu
- Step 4 Save and Test
12CONCEPT Actors vs Sprites
- Actors are the visual representations of the
characters in FUN games . - Sprites are considered to be living creatures
that live, move and die during the game. - Actors only define the shape that Sprites take to
be represented in the game.
13STEP 1 Start and Exit Buttons
- Add the Actor START_BUTTON
- Right-click Actors and Select Add.
- Enter START_BUTTON in the dialogue box and click
ok. - Add the Actor EXIT_BUTTON
- Right-click Actors and Select Add.
- Enter EXIT_BUTTON in the dialogue box and click
ok.
14CONCEPT Animation
- An animation is a sequence of one or many frames
that visually represent an action such as
walking, shooting etc - In Fun Animation Sets make up Actors.
15START BUTTON
- Add the Animation START_BUTTON
- Right-click on the START_BUTTON actor and select
Add Animation Set. - In the Control that comes up Enter the name of
the animation MAIN_MENU_START1 in the text box at
the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\
- Brix_Menu_Start1.bmp
- Click ok.
16START BUTTON CONTINUED
- Add the Second Animation START_BUTTON
- Right-click on the START_BUTTON actor and select
Add Animation Set. - In the Control that comes up Enter the name of
the animation MAIN_MENU_START2 in the text box at
the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\
- Brix_Menu_Start2.bmp
- Click ok.
17EXIT BUTTON
- Add the Animation EXIT_BUTTON
- Right-click on the EXIT_BUTTON actor and select
Add Animation Set. - In the Control that comes up Enter the name of
the animation MAIN_MENU_EXIT1 in the text box at
the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\
- Brix_Menu_Exit1.bmp
- Click ok.
18EXIT BUTTON CONTINUED
- Add the Second Animation EXIT_BUTTON
- Right-click on the EXIT_BUTTON actor and select
Add Animation Set. - In the Control that comes up Enter the name of
the animation MAIN_MENU_EXIT2 in the text box at
the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\
- Brix_Menu_Exit2.bmp
- Click ok.
19CONCEPT Game Loop
- A game loop is code that executes repeatedly
throughout a game and deals with taking input
from the user or other systems, then updates the
objects in the game and finally renders the
resulting objects to the screen.
20STEP 2 Cursor and Cursor Functions
- Add the Actor
- Right-click Actors and Select Add.
- Enter CURSOR in the dialogue box and click ok.
21THE CURSOR
- Add the Animation
- Right-click on the CURSOR actor and select Add
Animation Set. - In the Control that comes up Enter the name of
the animation ARROW in the text box at the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\Brix_Cursor_Arrow.bm
p and click ok.
22CURSOR Object Function Detect_Mouse_Over_Buttons
- Use
- Detect when the cursor is over a sprite and
change the animation for that sprite when it is. - Add the Object Function Mouse Over
- Right-click Object Functions and Select Add.
- Enter Detect_Mouse_Over_Buttons in the name box.
- Click on the Used By drop down menu and select
Cursor. - Enter the following code and save.
23Detect_Mouse_Over_Buttons
SpritePTR Start_Button( Start_Button
) SpritePTR Exit_Button( Exit_Button ) if (
pFunCursor-gtCollisionWithSprite( Start_Button )
) Start_Button-gtAnimation(1) else Start_Button
-gtAnimation(0) if ( pFunCursor-gtCollisionWithSp
rite( Exit_Button ) ) Exit_Button-gtAnimation(1)
else Exit_Button-gtAnimation(0)
24CURSOR Object Function Detect_Mouse_Click_On_But
tons
- Use
- Detect when the user clicks on a sprite and load
Level 1 or exit the game accordingly. - Add the Object Function Mouse Click
- Right-click Object Functions and Select Add.
- Enter Detect_Mouse_Click_On_Buttons in the name
box. - Click on the Used By drop down menu and select
Cursor. - Enter the following code and save.
25Detect_Mouse_Click_On_Buttons
if ( pFunCursor-gtIsPressedOnSprite(
Start_Button, DIM_LEFT) ) myGame-gtNextLevel
() else if ( pFunCursor-gtIsPressedOnSprite(
Exit_Button, DIM_LEFT) ) myGame-gtEndGame()
26STEP 3 The Main Menu
- Add The Level
- Right-click Game and select Add Level. The added
level will pop up at the end of the list of
levels. - Right-click on the new level and select Rename.
- Enter MainMenu in the box that pops up and then
click on OK.
27MENU CURSOR
- Set up the Cursor
- Expand the MainMenu Level.
- Right-click on Cursor and select Add.
- Uncheck the Use Default check box and select
CURSOR from the Actor drop down menu. - Now add the Detect_Mouse_Over_Buttons and
Detect_Mouse_Click_On_Buttons functions to the
Behaviors. - Click OK to close the cursor properties window.
28MAP
- Set up the Map
- Right-click on Maps and select Add.
- Enter Main_Menu for the name.
- Browse for the map file and select
- Brix\Art Assets\Maps\
- Brix_Main_Menu.bmp
- Now click OK to close the map properties window.
29SPRITES Start_Button
- Add the Sprite Start Button
- Right-click on Sprites and select Add.
- Enter Start_Button for the name.
- Select Main_Menu for the map.
- Click on the Animation tab and select
START_BUTTON for the actor. - Now click on the Collision tab and check the
Activate Sprite Collision check box. - Click on the Position tab and position the
Start_Button. - Now click OK to close the sprite properties
window.
30SPRITES Exit_Button
- Add the Sprite Exit Button
- Right-click on Sprites and select Add.
- Enter Exit_Button for the name.
- Select Main_Menu for the map.
- Click on the Animation tab and select EXIT_BUTTON
for the actor. - Now click on the Collision tab and check the
Activate Sprite Collision check box. - Click on the Position tab and position the
Exit_Button. - Now click OK to close the sprite properties
window.
31STEP 4 Save and Test
- Save the Project
- Click on Project and Save.
- Run the Project
- Click on the Build/Run button in the menu bar.
- Results
- Splash screen should display and then load the
Main Menu after 3 seconds.
32PART 3 BRIX LEVEL 1
- Objective
- Create Level 1 complete with the bricks, paddle
and ball. - Step 1 Bricks, Paddle and Ball
- Step 2 My Functions
- Step 3 Global Data
- Step 4 Level 1
- Step 5 Save and Test
33CONCEPT Collision
- A collision is when more than one object is
occupying the same position in space. - Collisions in games can be for many things such
as a ball bouncing around, a bullet colliding
with a ship or even a characters foot touching
the ground.
34STEP 1 BRICKS, PADDLE, BALL
- Add the Actor BRICK
- Right-click Actors and Select Add.
- Enter BRICK in the dialogue box and click ok.
35THE BRICK
- Add Animation Set
- Right-click on the BRICK actor and select Add
Animation Set. - In the Control that comes up Enter the name of
the animation BRICK_1 in the text box at the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\Brix_Brick1.bmp and
click ok - Now click on the Collision Data button and add
the collision data for this Animation frame. Be
sure that the collision data is pointing out. - Click OK to close the Animation Set window.
36THE BRICK Object Function DestroyBrick
- Add The Function DestroyBrick
- Right-click Object Functions and Select Add.
- Write the Function
- Enter DestroyBrick in the name box.
- Click on the Used By drop down menu and select
Sprites. - Enter the following code into the code window and
click on the save button when done.
37DestroyBrick
if (This-gtCollisionWithSprite("Ball")) This-gtUn
used(true) This-gtDeleteFlag(true)
38THE PADDLE
- Add the Actor
- Right-click Actors and Select Add.
- Enter PLAYER_PADDLE in the dialogue box and click
ok.
39THE PADDLE CONTINUED
- Add Animation Set
- Right-click on the PLAYER_PADDLE actor and select
Add Animation Set. - In the Control that comes up Enter the name of
the animation PADDLE_1 in the text box at the
top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\Brix_Paddle.bmp and
click ok - Now click on the Collision Data button and add
the collision data for this Animation frame. Be
sure that the collision data is pointing out. - Click OK to close the Animation Set window.
40THE PADDLE Object Function MoveWithArrows
- Use
- Detect when the player is pressing the left or
right arrow keys and move the paddle accordingly. - Add The Function MoveWithArrows
- Right-click Object Functions and Select Add.
- Enter MoveWithArrows in the name box.
- Click on the Used By drop down menu and select
Sprites. - Enter the following code into the code window and
click on the save button when done.
41MoveWithArrows
if ( pKeyboard-gtIsPressed(DIK_RIGHT)
) This-gtWorldPositionXInc( 5, 500 ) else if
( pKeyboard-gtIsPressed(DIK_LEFT)
) This-gtWorldPositionXDec( 5, 0 )
42CONCEPT Color Keying
- Color keying otherwise know as chroma keying is a
method of replacing a certain color in an image
with a false background. This method is used in
television to superimpose the weatherman in front
of the map and in many other special effects. - In games using transparencies gives the same
effect, and in Fun the transparency can be
selected for each Animation Set
43THE BALL
- Add the Actor
- Right-click Actors and Select Add.
- Enter BALL in the dialogue box and click ok.
44THE BALL CONTINUED
- Add Animation Set
- Right-click on the BALL actor and select Add
Animation Set. - In the Control that comes up Enter the name of
the animation BALL_1 in the text box at the top. - Click on Add to bring up the dialogue box for
choosing the frame art. - Select Brix\Art Assets\Actors\Brix_Ball.bmp and
click ok - Now click on the Collision Data button and add
the collision data for this Animation frame. Be
sure that the collision data is pointing out. - Click OK to close the Animation Set window.
45THE BALL Object FunctionBallCollision
- Use
- Increment the speed of the ball when it collides
with a Brick or the Paddle. - Add The Function BallCollision
- Right-click Object Functions and Select Add.
- Write the Function
- Enter BallCollision in the name box.
- Click on the Used By drop down menu and select
Sprites. - Enter the following code into the code window and
click on the save button when done.
46BallCollision
if( This-gtCollisionWithSprite("Brick")
) This-gtSpeedInc(0.5,10) else if(
This-gtCollisionWithSprite( "Player_Paddle")
) This-gtSpeedInc(0.5,10)
47THE BALL Object FunctionDetectOffScreen
- Use
- Detect when the ball is off of the screen, and
decrement the number of lives when this happens. - Add The Function DetectOffScreen
- Right-click Object Functions and Select Add.
- Write the Function
- Enter DetectOffScreen in the name box.
- Click on the Used By drop down menu and select
Sprites. - Enter the following code into the code window and
click on the save button when done.
48DetectOffScreen
if ( !This-gtInViewport() ) PlayerLives-- Spa
wnBall() This-gtSpeed(2)
49STEP 2 My Functions
- Definition
- My Functions (or user-defined functions) are
functions that have global scope throughout the
game play. They are independent of any FUN
objects. - Objective
- Use these to spawn the ball and give it a random
direction.
50SpawnBall
- Use
- Places the ball back in the viewport and gives it
a random direction. - Add the Function
- Right-click My Functions and Select Add.
- Enter SpawnBall in the name box.
- Enter void SpawnBall(void) in the Declaration
box. - Enter the following code into the code window and
click on the save button when done.
51SpawnBall
SpritePTR pBall( Ball ) SpritePTR
pPlayer_Paddle( Player_Paddle
) pBall-gtWorldPosition( pPlayer_Paddle-gtWorldP
ositionX(), pPlayer_Paddle-gtWorldPositionY()
30 ) pBall-gtSpeed(2) pBall-gtVectorDirection(
RandFlt(2), -RandFlt(2), 0 )
52STEP 3 Global Data
- Definition
- Global Data are data that have global scope
throughout the game play. They are independent of
any FUN objects. - Objective
- Create a variable to keep track of the number of
lives the player has.
53PlayerLives
- Use
- Keeps track of the number of lives that a player
has - Add the Data
- Right-click Global Data and Select Add.
- Enter PlayerLives in the name box.
- Select int for the type and click on unsigned.
- Enter 3 for the Initial Value.
- Click OK to close.
54STEP 4 Level 1
- Add The Level
- Right-click Game and select Add Level. The added
level will pop up at the end of the list of
levels. - Right-click on the new level and select Rename.
- Enter Level_1 in the box that pops up and then
click on OK.
55Level 1 CONTINUED
- Set the Level Properties
- Right-click Level_1 and select Properties.
- Now click on the On Start tab and enter the
following code. - Then click on OK.
56Level 1 On Start
SpawnBall() PlayerLives 3
57MAP
- Set up the Map
- Expand the Level_1 Level.
- Right-click on Maps and select Add.
- Enter Level1_Background for the name.
- Browse for the map file and select
- Brix\Art Assets\Maps\
- Brix_Background.bmp
58MAP CONTINUED
- Map Collision
- Click on the Collision Data button and put inward
collision on the left right and top sides and
either outward collision or no collision on the
bottom. - Save this collision data and close the window.
- Now click OK to close the map properties window.
59SPRITES Brick
- Add the Sprite Brick
- Right-click on Sprites and select Add.
- Enter Brick for the name.
- Select Level1_Background for the map.
- Change the Display List to 0.
- Click on the Animation tab and select BRICK for
the actor. - Click on the Behavior tab and add DestroyBrick
function to the list.
60Brick CONTINUED
- Now click on the Collision tab and select Precise
Collision. - Check the Activate Sprite Collision and Check
With Sprites check boxes. - Now click OK to close the sprite properties
window. - Create The Bricks Group
- Right-click on the Brick sprite and select Create
Group. - Place the Brick sprites in position here and
select Options/Create Sprites to place the
sprites int the group. - Now select Shapes/Close and enter Bricks for the
group name. - Click OK to create the group.
61SPRITES Player_Paddle
- Add the Sprite Player_Paddle
- Right-click on Sprites and select Add.
- Enter Player_Paddle for the name.
- Select Level1_Background for the map.
- Change the Display List to 1.
- Click on the Animation tab and select
PLAYER_PADDLE for the actor. - Click on the Behavior tab and add MoveWithArrows
function to the list.
62Player_Paddle CONTINUED
- Now click on the Collision tab and select Precise
Collision. - Check the Activate Sprite Collision and Check
With Sprites check boxes. - Check the Check Collision With Map check box.
- Click on the Position tab and position the
Player_Paddle. - Now click OK to close the sprite properties
window.
63SPRITES Ball
- Add the Sprite Ball
- Right-click on Sprites and select Add.
- Enter Ball for the name.
- Select Level1_Background for the map.
- Change the Display List to 2.
- Click on the Animation tab and select BALL for
the actor. - Click on the Behavior tab and add DetectOffScreen
and BallCollision functions to the list.
64Ball CONTINUED
- Now click on the Collision tab and select Precise
Collision. - Check the Activate Sprite Collision and Check
With Sprites check boxes. - Check the Check Collision With Map check box.
- Click on the Effects tab and check the Reflection
box. - Now click OK to close the sprite properties
window.
65STEP 4 Save and Test
- Save the Project
- Click on Project and Save.
- Run the Project
- Click on the Build/Run button in the menu bar.
- Results
- Level 1 should come up with the bricks, paddle
and ball. - Bricks should disappear when hit.
- The paddle should move with the arrow keys.
- The ball should bounce around.
66PART 4 Adding Sounds
- Objective
- Play sounds when different events happen like
when the ball hits something - Play music in the background.
- Step 1 Splash Screen Music
- Step 2 Main Menu Music
- Step 3 Level 1 Music
- Step 4 Update the Object Functions
- Step 5 Save and Test
67CONCEPT Sound
- In games sounds are used as audio responses to
events taking place. - There are 2 types, Sound Effects (SFX) and Music.
SFX are used for short clips such as footsteps
or a doorbell. Music is played in the background
sometimes to set the mood of the game at a given
time.
68STEP 1 Splash Screen Music
- Add The Sound
- Expand SplashScreen.
- Right-click on Sound Effects and select Add.
- Enter Intro_Music for the name.
- Change the Type to Music.
- Check the Loop check box.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\Music\
- JivinIntro.wav
- Now click OK to close the sound properties window.
69Splash Screen Music CONTINUED
- Update the Code
- Right Click on SplashScreen and select
Properties. - Click on the On Start tab and add the following
code. - Then click OK to close.
70Splash Screen On Start
StreamedSoundPTR pIntro_Music( Intro_Music
) pIntro_Music-gtPlay()
71STEP 2 Main Menu Music
- Add The Sound
- Expand MainMenu.
- Right-click on Sound Effects and select Add.
- Enter Menu_Music for the name.
- Change the Type to Music.
- Check the Loop check box.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\Music\
- JivinMenu.wav
- Now click OK to close the sound properties window.
72Main Menu Music CONTINUED
- Update the Code
- Right Click on MainMenu and select Properties.
- Click on the On Start tab and add the following
code. - Then click OK to close.
73Main Menu On Start
StreamedSoundPTR pMenu_Music( Menu_Music
) pMenu_Music-gtPlay()
74STEP 3 Level 1 Music
- Add The Sound
- Expand Level_1.
- Right-click on Sound Effects and select Add.
- Enter Level_Music for the name.
- Change the Type to Music.
- Check the Loop check box.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\Music\
- JivinLoop.wav
- Now click OK to close the sound properties window.
75Level 1 Music CONTINUED
- Update the Code
- Right Click on Level_1 and select Properties.
- Click on the On Start tab and add the following
code. - Then click OK to close.
76Level 1 On Start
StreamedSoundPTR pLevel_Music( Level_Music
) pLevel_Music-gtPlay()
77Level_1 Beep
- Add The Sound
- Expand Level_1.
- Right-click on Sound Effects and select Add.
- Enter Beep for the name.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\SFX\Beep1.wav
- Now click OK to close the sound properties window.
78Level_1 Boop
- Add The Sound
- Right-click on Sound Effects and select Add.
- Enter Boop for the name.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\SFX\Boop3.wav
- Now click OK to close the sound properties window.
79STEP 4 Update the Object FunctionsBallCollision
- Update the code
- Double-click on the BallCollision function to
bring up the Function Properties window. - Update the code with the following changes in
bold type then save.
80BallCollision Update
if( This-gtCollisionWithSprite("Brick")
) This-gtSpeedInc(0.5,10) SoundPTR
pBeep("Beep") pBeep-gtPlay() else if(
This-gtCollisionWithSprite("Player_Paddle")
) This-gtSpeedInc(0.5,10) SoundPTR
pBoop("Boop") pBoop-gtPlay()
81STEP 5 Save and Test
- Save the Project
- Click on Project and Save.
- Run the Project
- Click on the Build/Run button in the menu bar.
- Results
- Music should be played in the background.
- Sounds should play when the ball collides with a
brick or the paddle.
82PART 4 BRIX GAME LEVEL 2
- Objective
- Create a second level and detect when all of the
bricks are destroyed so the next level can be
loaded. - Step 1 Detect the end of the level.
- Step 2 Level 2
- Step 3 Save and Test
83STEP 1 Detect the End of the Level
- Add the Object Function
- Right-click Object Functions and Select Add.
- Enter DetectEndOfLevel in the name box.
- Change Used By to Levels and then enter the
following code and then save.
84DetectEndOfLevel Code
Sprite pBrick SpriteSearch("Brick") if(pBri
ck NULL) myGame-gtNextLevel()
85Detect the End of the Level CONTINUED
- Update the Behaviors
- Right-click on Level_1 and select Properties.
- Click on the Behavior tab and add the
DetectEndOfLevel function to the list of
behaviors. - Click OK to close.
86STEP 2 Create Level 2
- Add the Level
- Right-Click on Level_1 and select Insert Copy
- Enter Level_2 for the name and click on Insert
After Level_1. - Click OK to close.
87Level 2 CONTINUED
- Modify Level 2
- Right-Click on Level_2 and select Properties.
- Click on the On Start tab and remove the
following line of code. -
- PlayerLives 3
- Click OK to close.
88Level 2 Bricks Group
- Restore to a Single Sprite
- Now right-click on the Bricks sprite group in
Level_2 and select Rename. - Enter Brick and click OK.
- Right-click on the Brick sprite group and select
Restore to One. - Recreate The Bricks Group
- Right-click on Brick and select Create Group.
- Place the Brick sprites in position here and
select Options/Create Sprites to place the
sprites in the group. - Now select Shapes/Close and enter Bricks for the
group name. - Click OK to create the group.
89STEP 3 Save and Test
- Save the Project
- Click on Project and Save.
- Run the Project
- Click on the Build/Run button in the menu bar.
- Results
- Level 2 should load when all the blocks are
destroyed in Level 1.
90PART 5 Win/Lose Screens
- Objective
- Create Winning and Losing screens to be displayed
when the player wins or loses. - Step 1 Detect Winning/Losing.
- Step 2 Winning Screen
- Step 3 Losing Screen
- Step 4 Save and Test
91STEP 1 Detect Winning/Losing
- Note The game is already set up to detect
winning because this happens when the bricks are
all destroyed and the DetectEndOfLevel function
does this for us. - Detect Losing
- Double-click on DetectOffScreen and change the
code to match the following
92DetectOffScreen Update
if ( !This-gtInViewport() ) PlayerLives-- if
( PlayerLives 0 ) myGame-gtLevelName(
LosingScreen ) else SpawnBall() This-gt
Speed(2)
93STEP 2 The Winning Screen
- Add The Level
- Right-click Game and select Add Level. The added
level will pop up at the end of the list of
levels. - Right-click on the new level and select Rename.
- Enter WinningScreen in the box that pops up and
then click on OK.
94Winning Screen CONTINUED
- Set the Level Properties
- Right-click WinningScreen and select Properties.
- Click on the Behavior tab.
- Add the MyTimer function to the list.
- Now click on the On Start tab and enter the
following code. - Click OK to close.
95Winning Screen On Start
StreamedSoundPTR pWin_Music( Winning_Music
) pWin_Music-gtPlay()
96MAP
- Set up the Map
- Right-click on Maps and select Add.
- Enter Winning_Screen for the name.
- Browse for the map file and select
- Brix\Art Assets\Maps\Brix_Winning_Screen.bmp
- Now click OK to close the map properties window.
97SOUND EFFECTS
- Add The Sound
- Right-click on Sound Effects and select Add.
- Enter Winning_Music for the name.
- Change the Type to Music.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\Music\
- JivinEndingPos.wav
- Now click OK to close the sound properties window.
98STEP 3 The Losing Screen
- Add The Level
- Right-click Game and select Add Level. The added
level will pop up at the end of the list of
levels. - Right-click on the new level and select Rename.
- Enter LosingScreen in the box that pops up and
then click on OK.
99Losing Screen CONTINUED
- Set the Level Properties
- Right-click LosingScreen and select Properties.
- Click on the Behavior tab.
- Add the MyTimer function to the list.
- Now click on the On Start tab and enter the
following code. - Click OK to close.
100Losing Screen On Start
StreamedSoundPTR pLose_Music( Losing_Music
) pLose_Music-gtPlay()
101MAP
- Set up the Map
- Right-click on Maps and select Add.
- Enter Losing_Screen for the name.
- Browse for the map file and select
- Brix\Art Assets\Maps\Brix_Losing_Screen.bmp
- Now click OK to close the map properties window.
102SOUND EFFECTS
- Add The Sound
- Right-click on Sound Effects and select Add.
- Enter Losing_Music for the name.
- Browse for the sound file and select
- Brix\Art Assets\Sounds\Music\
- JivinEndingNeg.wav
- Now click OK to close the sound properties window.
103STEP 4 Save and Test
- Save the Project
- Click on Project and Save.
- Run the Project
- Click on the Build/Run button in the menu bar.
- Results
- The winning/losing screens should display when
the player wins/loses.
104Final Test
- Brix is now completed!! Take some time to enjoy
your creation.