ARS361
Interactive Digital Multimedia
Instructor: B. Lattanzi
rev.2/8/04


--EXAMPLE OF LINGO CASE STATEMENT

--THE EXAMPLE CONTROLS UP AND DOWN MOVEMENT.

--1ST. TRY CONTROLLING RIGHT AND LEFT MOVEMENT, TOO.
(hint: create another flag variable)

--2ND. TRY MORE VARIED MOVEMENT BY CHANGING BOTH
VERTICAL AND HORIZONTAL MOVEMENTS
EVERY STATE-CHANGE.

-- 3RD. TRY USING OTHER PROPERTIES, SUCH AS SIZE, ETC.

-- 4TH. TRY TURNING "ON" THE TRAILS PROPERTY FOR THE SPRITE

property ballSpr, directionFlag

on beginSprite me
  ballSpr = sprite(me.spriteNum)
  directionFlag = #up
end

on exitFrame me
  if ballSpr.locV > 480 then
     directionFlag = #up
  end if

  if ballSpr.locV < 0 then
     directionFlag = #down
  end if

  case directionFlag of
     #up:ballSpr.locV = ballSpr.locV - 4
     #down:ballSpr.locV = ballSpr.locV + 4
  end case

  ballSpr.locH = ballSpr.locH + 1
end