Computer Science Canada

Help?

Author:  Alexx [ Sun Apr 18, 2004 12:57 pm ]
Post subject:  Help?

Hi, guys I have one problem with my screensaver.
Code
View.Set ("graphics:400;400,offscreenonly")

var num_Balls : int := 10
var x, y, dx, dy, clr : array 1 .. num_Balls of int

for i : 1 .. num_Balls
x (i) := Rand.Int (50, maxx - 50)
y (i) := Rand.Int (50, maxy - 50)
dx (i) := Rand.Int (-3, 3)
dy (i) := Rand.Int (-3, 3)
clr (i) := Rand.Int (1, 200)
end for

loop

exit when hasch
cls

for i : 1 .. num_Balls

x (i) := x (i) + dx (i)
y (i) := y (i) + dy (i)

if x (i) < 50 or x (i) > maxx - 50 then
dx (i) := -dx (i)
end if
if y (i) + dy (i) < 50 or y (i) + dy (i) > maxy - 50 then
dy (i) := -dy (i)
end if

drawfilloval (x (i), y (i), 50, 50, clr (i))
drawfilloval (x (i) - 20, y (i) + 20, 10, 10, black)
drawfilloval (x (i) + 20, y (i) + 20, 10, 10, black)
drawarc (x (i), y (i), 40, 40, 180, 350, black)

end for

View.Update
delay (10)

end loop

There is too many balls that around the screen, but my question is how I do this when one ball touch the y value then other ball appear and then ball touch the x value then one more ball appear.

Author:  Cervantes [ Sun Apr 18, 2004 1:05 pm ]
Post subject: 

3 things:
first: don't put the subject of your post as "Help?". Your posting in the turing help section, we know you want help. Wink giving it an effective title just helps to keep things clean around here.

second: use the code tags when posting code. type this:
[ code ] put your code here [ /code]
only without the spaces.

third: I'm not exactly sure what you are asking.

Alexx wrote:
how I do this when one ball touch the y value then other ball appear and then ball touch the x value then one more ball appear.


wha? Eh what do you mean by y value and x value? y and x value of what? another ball? or the wall? Thinking

Author:  gamer [ Sun Apr 18, 2004 1:07 pm ]
Post subject: 

ya man if u want people to help u gota be more specific then that


: