ARS361
Interactive Digital Multimedia
Instructor: B. Lattanzi
rev.2.8.04


--ANOTHER EXAMPLE OF LINGO CASE STATEMENT

property ballSpr, locState

on beginSprite me
    ballSpr = sprite(me.spriteNum)
   ballSpr.trails = 1
   locState = 0
end

on exitFrame me
   if ballSpr.locV < 0 then
      locState = 1
   end if

   if ballSpr.locV > 480 then
      locState = 2
   end if

   if ballSpr.locH > 640 then
       locState = 3
   end if

   if ballSpr.locH < 0 then
       locState = 4
   end if


   case locState of
      0: ballSpr.locV = ballSpr.locV + 10
         ballSpr.locH = ballSpr.locH + 5
      1: ballSpr.locV = ballSpr.locV + 9
          ballSpr.locH = ballSpr.locH + 4
     2: ballSpr.locV = ballSpr.locV - 8
         ballSpr.locH = ballSpr.locH + 3
     3: ballSpr.locH = ballSpr.locH - 10
         ballSpr.locV = ballSpr.locV + 5
    4:ballSpr.locH = ballSpr.locH + 9
       ballSpr.locV = ballSpr.locV + 3
   end case
end