Thanks for the replys guys!
im going to play about and see which one of u is right
btw this is for the medialess space-epic which is hidden away in the 2d section of the forum . All codes will be avalable to crit or improve in there , it just happened ater i asked a 2d question with vanB , now were colaberating on a medialess extravagansa. Check it out .
http://forum.thegamecreators.com/?m=forum_view&t=190266&b=4&msg=2268769#m2268769
This problem is for the space traffic bit , i want all planets within xdist to become random spawn/destination points for the traffic .
Rem Project: space traffic
Rem Created: Saturday, October 29, 2011
Rem ***** Main Source File *****
sync on
sync rate 0
set display mode desktop width(),desktop height(),32
backdrop on
'make collision spheres/ planet spheres
for planets = 2000 to 2250
make object sphere planets,150,6,6
if object collision (planets ,planets)=1
position object planets,rnd(10000)-5000,rnd(5000)-2500,rnd(10000)-5000
endif
next planets
for pcol = 2500 to 2750
make object cube pcol,1500
hide object pcol
position object pcol,object position x(pcol-500),object position y(pcol-500),object position z(pcol-500)
next pcol
for npc = 10000 to 10999
make object cube npc,50
color object npc,rgb(250,0,0)
hide object npc
dim spawndest((npc-10000),1,1)
dim speedtraffic#((npc-10000))
NEXT npc
set camera range 0,1,150000
point camera 0,0,0,0
make = 10000
position camera 0,11500,200,0
point camera 0,0,0,0
temp = make vector3(1)
do
rand1 = rnd(6)
if rand1 = 6
if object visible(make)= 1 then inc make,1
if object visible(make)= 0
spawndest((make-10000),1) = (rnd(249)+2000);randomize rnd(673490)
spawndest((make-10000),1,1) = (rnd(249)+2000)
position object (make),object position x(spawndest((make-10000),1)),object position y(spawndest((make-10000),1)),object position z(spawndest((make-10000),1))
show object make
inc make, 1
rand1 = 0
endif
endif
if make >10999 then make = 10000
text 20,40," number spawn = " +str$(make-10000)
for npc = 10000 to 10999
if object visible (npc) = 1
if speedtraffic#((npc-10000)) < .001 > 0
point object (npc),object position x(spawndest((npc-10000),1,1)),object position y(spawndest((npc-10000),1,1)),object position z(spawndest((npc-10000),1,1))
if speedtraffic#(npc-10000) => (3 + (npc/50000)) then speedtraffic#((npc-10000))=(3+ (npc/50000))
endif
if speedtraffic#((npc-10000)) <(3+ (npc/50000)) then inc speedtraffic#((npc-10000)),.001
move object npc,speedtraffic#((npc-10000))
if object collision (npc,spawndest((npc-10000),1,1) + 500) = 1
if speedtraffic#((npc-10000)) > .2
dec speedtraffic#((npc-10000)),.001
endif
endif
if object collision (npc,spawndest((npc-10000),1,1)) = 1
hide object (npc)
speedtraffic#((npc-10000)) = 0.0
position object (npc),0,0,0
inc home,1
endif
endif
if object in screen (npc) = 0 then inc offscreen,1:hide object (npc) :position object (npc),0,0,0
next npc
if spacekey() = 1
selectP = rnd(249)+2000
for scanplanets = 2000 to 2250
xdist# = object position x(scanplanets) - object position x(selectP)
ydist# = object position y(scanplanets) - object position y(selectP)
zdist# = object position z(scanplanets) - object position z(selectP)
set vector3 1,xdist#,ydist#,zdist#
dist# = length vector3(1)
if (selectP = scanplanets) = 0 then color object scanplanets ,rgb(255,255,255)
if dist# > 2000
color object scanplanets ,rgb(0,0,255)
endif
if dist# < 2000
color object scanplanets ,rgb(200,200,0)
endif
color object (selectP),rgb(0,200,0)
NEXT scanplanets
endif
text 500,40, " fps : "+str$(screen fps())
text 500,70, "home runs : "+str$(home)
text 500,100,"offscreens : "+str$(offscreen)
sync
loop
Its...its aliiive!
spacekey to change planet .
so i want the yellow and green planets to be on the list , the blue planets taken off the list.
I will change the distance formula in my main project too , the vector way is much nicer ty.