Hi just wander how you use the for next command to make more than one of the same objetc and place each randomly.
please help
howdy mate...
are u using types or an array? and is it in 2d or 3d? i would suggest types myself. This is how i would do it in 2D, but 3D uses the same principle:
global screen_x_res = 800 ;chenge these to the resolution
global screen_y_res = 600 ;you want
graphics screen_x_res,screen_y_res,16,1
type thing
field xPos,Ypos
end type
; this creates 10 randomly placed objects:
for x = 1 to 10
a.thing = new thing
a\xpos = rnd(screen_x_res) ; creates a random number
a\Ypos = rnd(screen_y_pos) ,between 0 and the ()
next
hope this helps......
here's an example for 3D:
Type enemy
Field entity
Field x#
Field y#
Field z#
End Type
Global alien=LoadMesh("alien.b3d")
;Make 50 objects
For i=1 To 50
e.enemy = New enemy
e\entity=CopyEntity(alien)
e\x#=Rnd(-100.0,100.0)
e\y#=Rnd(-100.0,100.0)
e\z#=Rnd(-100.0,100.0)
PositionEntity e\entity,e\x#,e\y#,e\z#
Next
i hope it makes sense ;-)