//----------------------------------------------------------------------------
// Lesson6
// And now we actual make an image move around!
//----------------------------------------------------------------------------
//
// So, all we have to do to move the image around is to put variables where
// the constants are in the IMAGE command, and change their values in the
// DURING thinkswitch.
//
//----------------------------------------------------------------------------
//
// So, run Lesson6 by doing the following.  Once this is under your belt,
// it's time to think about making a game, which we'll do together!
//
//       MAP TEST
//       LOADAPE Lesson6
//       INVOKE 2:1
//
// Move on to Lesson 7!
//
//#############################################################################
// DEFINES
//#############################################################################

#define $Lesson6        "2"
#define $Movement      "1"
#define $Before        "2"
#define $During        "3"
#define $After         "4"

//#############################################################################
// CODE
//#############################################################################
#window $Lesson6:$Movement
startswitch $Lesson6:$Before
thinkswitch $Lesson6:$During
finishswitch $Lesson6:$After
//-------------------------------------------------------
width 256
height 256
body "Haylo."
image pooper\guy$counter$.pcx xLoc,40


//=======================================================
#switch $Lesson6:$Before
counter = 0
xLoc = 10
deltaX = 1
return

//=======================================================
#switch $Lesson6:$During
counter = counter + 1         // update our animation counter
if (counter > 3) set counter = 0 // if too big, back to frame 1
xLoc = xLoc + deltaX              // add change to X location                  
if (xLoc > 200) deltaX = -1       // if on right side, go left
if (xLoc < 11) deltaX = 1         // if on left side, go right
return

//=======================================================
#switch $Lesson6:$After
unset counter
unset xLoc
unset deltaX
return