//----------------------------------------------------------------------------
// Lesson7: MAKING A GAME
//
// What game should look at for things to try?  Well, the simplest game I
// know is Pong, so let's look at that.  
//
// What do we need for Pong?  Well, we need some shapes, some sounds, and
// some code.  Luckily, we've pre-made the first two.  But how did we make
// them?
//
// GRAPHICS
// Provided with Windows is Paint, which you can use to make the game
// graphics.  They can all be BMP format, except for the shapes travelling
// over the background.  Those have to be saved as PCX, and color 255 needs
// to be wherever you want to see through the shape.  I would just use
// PCXs all the time when making a game.  You can get fancier programs to
// do graphics, but that will do for now.
//
// SOUND
// There are fancier sound programs, but you can just use Sound Recorder,
// which is under PROGRAMS/ACCESSORIES/ENTERTAINMENT/SOUND RECORDER in the
// Start menu.  It'll get you something you can use.
//
// Okay, since we have the graphics and sounds done already, let's use them
// to make Zong!
//
// First off, let's make a ball bounce around in the window.  This
// demonstrates collision with the window boundaries.
//
// Continue here!
//
//       MAP TEST
//       LOADAPE Lesson7
//       GOAPE 2:1
//
// Move on to Lesson 8!
//
//#############################################################################
// DEFINES
//#############################################################################

#define $Lesson7        "2"
#define $HitTheWalls   "1"
#define $Before        "2"
#define $During        "3"
#define $After         "4"

#define $TOPSIDE       "1"
#define $LEFTSIDE      "1"
#define $RIGHTSIDE     "232"
#define $BOTTOMSIDE    "232"

//#############################################################################
// CODE
//#############################################################################
#window $Lesson7:$HitTheWalls
startswitch $Lesson7:$Before
thinkswitch $Lesson7:$During
finishswitch $Lesson7:$After
//-------------------------------------------------------
width 256
height 256
body "Bouncing Ball Demo"
font "Boost12"
image "zong\zongball.pcx" zongX,zongY


//=======================================================
#switch $Lesson7:$Before
zongX = 200
zongY = 128
deltaX = 1
deltaY = 1
return

//=======================================================
#switch $Lesson7:$During
zongX = zongX + deltaX              // add change to X location                  
zongY = zongY + deltaY              // add change to Y location                  
if (zongX > $RIGHTSIDE) deltaX = -1       // if on right side, go left
if (zongX < $LEFTSIDE) deltaX = 1         // if on left side, go right
if (zongY > $BOTTOMSIDE) deltaY = -1       // if at bottom side, go up
if (zongY < $TOPSIDE) deltaY = 1         // if at top side, go down
return

//=======================================================
#switch $Lesson7:$After
unset zongX
unset zongY
unset deltaX
unset deltaY
return