1Setup

1640x480

132 Bit

1Borland Free Command line

1“Bricks – Your Name”

1Add Background

1Brix_Background

1Add collision data (around whole map)

1Add ball

1Actor “Red”

1Animation “

1Add Collision Data

1Add this ball to the screen

1Add Sprite

1Name “Ball” (needs to be the same as in your code)

1Background Map

1Animation – Add the actor

1Position, middle of screen (do the math) (320, 240)

1displacement 3, 33degrees

1Collision – precise, check with map, check with sprites

1Effects – reflection

1Build it (And save!)

1Add Actor Brix

1Actor

1Name Brix

1Add animation set (Brix_Brick1)

1Add collision data (from the right direction!)

1Add brix sprite

1Name “Brick”

1Add to map

1Use animation “brix”

1Collision

1Precise

1Sprite collision (Both checks?)

1NO MAP COLLISION (why not?)

1Make a sprite group

1“Brick” sprite – add group

1Name it BrickGroup

1Run it ... ok ... but they need to disappear

1Add behavior to kill brick

1Object Function

1Name – DestroyBrick

1Used by – Sprites

// If I get hit be a ball then I get destroyed

if (This->CollisionWithSprite("Ball"))

This->DeleteFlag(true);

1Now, add it to the correct sprite ...

1Right click to reduce the sprite group to one

1Rename (so no “group” in the name)

1Then for the one sprite

1Properties->Behavior

1Select function, hit +

1Make a brick group again (now that it has behavior)

1Add the paddle!

1Add actor – Paddle

1Add animation – “Brix_Paddle”

1Collision data (add the correct direction)

1Add sprite “Paddle”

1Name – Paddle

1Add the Background map

1Animation – Paddle

1Position (use “...” to put on bottom)

1Collision – Precise – sprites and map

1Add behavior to move the paddle

1Behavior->Object function

1“MoveWithArrows”

1Applys to sprites

Move with arrows

if ( pKeyboard->IsPressed(DIK_RIGHT) )

{

This->WorldPositionXInc( 5, 500 );

}

else if ( pKeyboard->IsPressed(DIK_LEFT) )

{

This->WorldPositionXDec( 5, 0 );

}

Other Keys would be DIK_Y for the “Y” key for instance ... I have not yet found a list. But probablu DIK_ENTER, DIK_SHIFT, etc.

15Add behavior to detect the ball off screen

15Behavior -> Object Functions Add

“DetectOffScreen” - Apply to Sprites

if ( !This->InViewport() )

{

This->WorldPosition(320,240);

}

1Still goes off screen Why?

1Remove the collision data at the bottom

1Go to the Map, collision data – remove or reverse the bottom collision line.

1Make the ball speed up as you play, and beep

1First add in the sound asset

1On the level – Right click Sound effects – Select Additional

1Call it “Beep” add the file “Beep1”

1Now add the behavior for it

1Add behavior – BallCollision – Applies to sprite

BallCollision

1if( This->CollisionWithSprite("Brick") )

{

This->SpeedInc(0.5,10);

SoundPTR pBeep("Beep"); <-- it's your file name

pBeep->Play();

}

Why SoundPTR?? With This the object already exists ... here, we need to create it.

1Course, now it speeds up faster and faster ...

1When it respawns we need to do something more

1We're going to make a function that is not tied to sprite that we can put anywhere.

1MyFunctions -> Additional

1Call it SpawnBall

1Void SpawnBall(void)

1Code as follows ...

SpritePTR pBall( "Ball" );

SpritePTR pPaddle( "Paddle" );

pBall->WorldPosition(

pPaddle->WorldPositionX(),

pPaddle->WorldPositionY() - 30 );

pBall->Speed(2);

pBall->VectorDirection( RandFlt(2), -RandFlt(2), 0 );

1Go to behavior “DetectOffScreen”

1Instead of “This->WorldPosition” put

1SpawnBall();

1

1Add a closing screen

1Right click Game -> Add level

1Right Click “Level 2” - RENAME

1Call it “GameOver”

1Add the “Losing screen” asset for the map

1How can we get to it ... we need lives ...

1Global Data -> Properties

1Name = Lives

1Variable

1type unsigned “int”

1Click “OK”

1Now where would we erase lives .... in which behavior?

1Add this code to “Detect Off Screen”

DetectOffScreen

if ( !This->InViewport() )

{

Lives--;

if (Lives == 0 )

myGame->LevelName( "GameOver" );

else

{

SpawnBall();

}

} <----- add this too

1Add to the paddle sprite

1No add behavior to detect that the ball is off screen.

1Add behavior – Object function

1DetectOffScreen

1apply to sprites

Detect end of level

Add the opening screen

Add a new level – call it splash

Then add a behavior

MyTimer

Applys to levels

“Activate timer”

myGame->LevelName("MainMenu");

Apply the code to the level named “Splash”

Apply it to the “End of Game” one too.

Main Menu

1Game->Add Level “Main_Menu”

1Add Map “Main_Menu)

1Add the cursor actor

1Add cursor to Main_Menu Level (NOT A SPRITE ... CURSOR)

1Add actor “Start_Button”

1Give it animation

1No collision data

1Do the same for the “Exit_Button”

1Add sprite to main menu level

1Use the start_button actor

1Position it

1Active sprite collision

1That's about it

1Add behavior

1“Detect_Mouse_Click_On” --- APPLIES TO CUSOR

1

Detect_Mouse_Click_On_Button

if ( pFunCursor->IsPressedOnSprite( "Start_Button", DIM_LEFT) )

myGame->LevelName(“Level_1);

Not this yet

else if ( pFunCursor->IsPressedOnSprite( "Exit_Button", DIM_LEFT) )

myGame->EndGame();

1Add behavior to cursor

1Change – MyTimer to go to Main_Menu

1Change – End of game to go to Main_menu (add the timer function)

Detect_Mouse_Over_Button

SpritePTR Start_Button( "Start_Button" );

SpritePTR Exit_Button( "Exit_Button" );

if ( pFunCursor->CollisionWithSprite( "Start_Button" ) )

Start_Button->Animation(1);

else

Start_Button->Animation(0);

if ( pFunCursor->CollisionWithSprite( "Exit_Button" ) )

Exit_Button->Animation(1);

else

Exit_Button->Animation(0);

DetectEndOfLevel

Sprite* pBrick = Sprite::Search("Brick");

if(pBrick == NULL)

myGame->NextLevel();

BallCollision

1if( This->CollisionWithSprite("Brick") )

{

This->SpeedInc(0.5,10);

SoundPTR pBeep("Beep");

pBeep->Play();

}

Add the BOOP sound

else if( This->CollisionWithSprite( "Player_Paddle") )

{

This->SpeedInc(0.5,10);

SoundPTR pBoop("Boop");

pBoop->Play();

}