Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Random Movement

Author
Message
Big Shot
21
Years of Service
User Offline
Joined: 27th Apr 2004
Location: dunno...
Posted: 15th Jul 2004 22:57
Does anyone know how I can simply get an object to move around randomly?
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 15th Jul 2004 23:54
RANDOMIZE(TIMER) will create a random seed.

From this point, look up RND in the help to learn how to create a random number within the range required.

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 16th Jul 2004 03:26
one object that moves at random....

sync on:sync rate 60
make object sphere 1,1
position camera 100,100,-100
point camera 100,100,0
position object 1,100,100,0
point object 1,0,0,0
distance=10
do
repeat
move object 1,0.5
traveled#=traveled#+0.5
sync
until traveled#>=distance
point object 1,rnd(200),rnd(200),0
distance=rnd(20)+2
traveled#=0
loop

hope thats what you meant, cheers.

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, Nvidia FX5900 gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster.

Login to post a reply

Server time is: 2025-05-26 02:42:22
Your offset time is: 2025-05-26 02:42:22