this makes it work.
sub generate_oval( byval new_oval as ovals ptr,_
byval x_limit as integer,_
byval y_limit as integer )
new_oval->colour=int_rnd( &hff000000, &hfff000f0 )
new_oval->radius=float_rnd( 0.85f, 13.8f )
new_oval->pos_x=float_rnd( new_oval->radius, csng( x_limit ) - new_oval->radius )
new_oval->pos_y=float_rnd( new_oval->radius, csng( y_limit ) - new_oval->radius )
Dim As Integer outcome
Dim As Integer itterations
outcome = position_check( new_oval )
While ( outcome = TRUE And oval_total < MAX_OVALS )
If outcome = TRUE Then
new_oval->radius=float_rnd( 0.85f, 13.8f )
new_oval->pos_x=float_rnd( new_oval->radius, csng( x_limit ) - new_oval->radius )
new_oval->pos_y=float_rnd( new_oval->radius, csng( y_limit ) - new_oval->radius )
End If
outcome = position_check( new_oval )
itterations += 1
If itterations > 10 Then MAX_OVALS = oval_total
Wend
End sub
you will have to change MAX_OVALS to a shared integer insted of a const. because the MAX_OVALS has just been changed then it skips a lot of test further up in the code.
it works quite well you might like to use seconds in the while loop instead of itterations as then it will give the while loop the same time on every pc.