
-----------------------------------
DanielG
Fri Feb 08, 2008 8:41 pm

An unusual bouncing circle program
-----------------------------------
I was bored trying some programming problem and decided to make this, this is like the normal bouncing circle programs that bounce off the walls, only this moves "randomly".


setscreen ("graphics, offscreenonly")

var x, y : int := 40
var r := 5
var vx, vy := 6
var vr := 1

loop
    vx += Rand.Int (-3, 3)
    vy += Rand.Int (-3, 3)
    vr += Rand.Int (-1, 1)
    if vx > 10 then
        vx := 10
    end if
    if vy > 10 then
        vy := 10
    end if
    if vr > 3 then
        vr := 3
    end if
    x += vx
    y += vy
    r += vr

    if x = maxx - abs (r) then
        x := maxx - abs (r)
        vx := -abs (vx)
    end if
    if y = maxy - abs (r) then
        y := maxy - abs (r) 
        vy := -abs (vy)
    end if
    if r >= 50 then
        vr := -abs (vr)
    end if
    if r 