# Bouncing ball demo
# define walls
reset all
assign t 96
assign b 4
assign l 4
assign r 50

# define 'ball 1'
assign z 4
assign x 4
assign y 4
assign s 2

# define 'ball 2'
assign o 3
assign m 4
assign n 24
assign u 4

assign h 1
assign v 1

assign i 1
assign w 1

loop a 551
  cls black
  colour yellow
  move 8 88
  chars Bouncy!
  colour red
  circle fill x y z
  colour green
  circle fill m n o
  add frame
  if x>=r then assign h 2
  if x<=l then assign h 1
  if y>=t then assign v 2
  if y<=b then assign v 1
  if h=1 then inc x s
  if h=2 then dec x s
  if v=1 then inc y s
  if v=2 then dec y s
  if m>=r then assign i 2
  if m<=l then assign i 1
  if n>=t then assign w 2
  if n<=b then assign w 1
  if i=1 then inc m u
  if i=2 then dec m u
  if w=1 then inc n u
  if w=2 then dec n u
endloop a
cls black
colour yellow
move 8 88
chars Bouncy!
colour red
circle fill x y z
colour green
circle fill m n o