this script works except the ball bounces off
the stage border only when half of it is over the border.
how do I make it bounce off right away?

script:

-- ball bounces off when hits stage border

global horDir, verDir, stageWidth, stageHeight

on beginsprite
  
  horDir = 5
  verDir = 5
  
  stageWidth = (the stageright - the stageleft)
  stageHeight = (the stagebottom - the stagetop)
  
end

on exitFrame me
  
  my = sprite(me.spriteNum)
  
  my.locH = my.locH + horDir -- horizontal
  my.locV = my.locV + verDir -- vertical
  
  if my.locH < 0  then horDir = 5  -- go right
  if my.locH > stageWidth  then horDir = -5 -- go left
  
  if my.locV < 0 then verDir = 5  -- go down
  if my.locV > stageHeight then verDir = -5 -- go up
  
  go to the frame
  
end
[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to