An unusual bouncing circle program
Author |
Message |
DanielG
|
Posted: Fri Feb 08, 2008 8:41 pm Post subject: 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".
code: |
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 <= abs (r) then
x := abs (r)
vx := abs (vx)
end if
if x >= maxx - abs (r) then
x := maxx - abs (r)
vx := -abs (vx)
end if
if y <= abs (r) then
y := abs (r)
vy := abs (vy)
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 <= -50 then
vr := abs (vr)
end if
drawfilloval (x, y, r, r, black)
View.Update
delay (30)
cls
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
BigBear
|
Posted: Fri Feb 08, 2008 9:11 pm Post subject: Re: An unusual bouncing circle program |
|
|
Nice little program with clean code well done. |
|
|
|
|
|
Jestar
|
Posted: Fri Feb 08, 2008 10:14 pm Post subject: RE:An unusual bouncing circle program |
|
|
haha very cool. |
|
|
|
|
|
DanielG
|
Posted: Fri Feb 08, 2008 10:32 pm Post subject: RE:An unusual bouncing circle program |
|
|
Thanks |
|
|
|
|
|
apomb
|
Posted: Sat Feb 09, 2008 7:55 am Post subject: RE:An unusual bouncing circle program |
|
|
no, this is not "unusual", this is not "cool"
it is overdone and frankly not worth posting.
why waste space on the servers for terrible "cool" programs, ... make something worthwile for pete's peppers. |
|
|
|
|
|
Euphoracle
|
Posted: Sat Feb 09, 2008 12:13 pm Post subject: RE:An unusual bouncing circle program |
|
|
People with a highschool credit in turing post here CompWiz333, you can't expect the next great CAD compilation or web design suite to appear here in turing. |
|
|
|
|
|
Nyrd
|
Posted: Sun Feb 10, 2008 10:08 pm Post subject: RE:An unusual bouncing circle program |
|
|
Trippy . . . |
|
|
|
|
|
|
|