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 Professional Discussion / Position Object in For-Next Loop? :-S

Author
Message
Luigison
23
Years of Service
User Offline
Joined: 9th Jun 2003
Location: California
Posted: 20th Aug 2003 08:29
For some reason when I use the for-next loop below it only shows the first object, but I can position each object idividually and see them all.

rem why won't the below for-next loop work?
`FOR n = 1 TO 10
`POSITION OBJECT n,x+11,y,z+11
`NEXT n

rem the above for-next loop 'should' do the following
POSITION OBJECT 1,-99,-64,-99
POSITION OBJECT 2,-88,-64,-88
POSITION OBJECT 3,-77,-64,-77
POSITION OBJECT 4,-66,-64,-66
POSITION OBJECT 5,-55,-64,-55
POSITION OBJECT 6,-44,-64,-44
POSITION OBJECT 7,-33,-64,-33
POSITION OBJECT 8,-22,-64,-22
POSITION OBJECT 9,-11,-64,-11
POSITION OBJECT 10,0,-64,0

See the rest of my soure code below.
randi
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United States
Posted: 20th Aug 2003 09:18
It seems to me that...

All of your objects are cubes...
and they all are being positioned in the same place using the for/next loop.

You have given 'x' and 'z' a value, -99.

Then you position every object at...
x+11,y,z+11

So all objects are at...
-99+11, y, -99+11

And since they are all cubes...
It looks like just one cube.

When you do it individualy...
POSITION OBJECT 1,-99,-64,-99
POSITION OBJECT 2,-88,-64,-88
POSITION OBJECT 3,-77,-64,-77
POSITION OBJECT 4,-66,-64,-66
POSITION OBJECT 5,-55,-64,-55
POSITION OBJECT 6,-44,-64,-44
POSITION OBJECT 7,-33,-64,-33
POSITION OBJECT 8,-22,-64,-22
POSITION OBJECT 9,-11,-64,-11
POSITION OBJECT 10,0,-64,0


You have different values.

try...

for n=1 to 10
POSITION OBJECT n,((n-1)*11)+x,y,((n-1)*11)+z
next n

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Aug 2003 10:06
this is all you have to do.

Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 20th Aug 2003 14:25
I wouldn't listen to Randi. She's just helping people to try and impress me. Whether she knows what she's talking about it debatable.

Insiiiiiiiiiiiiiiiiiiiiiiiide!
Defoman
23
Years of Service
User Offline
Joined: 1st Nov 2002
Location:
Posted: 23rd Aug 2003 20:39
Randi is right.. You are not changing the values of x or y in your loop, and they are all piling on top of each other.
David T
Retired Moderator
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 23rd Aug 2003 21:06
Quote: "I wouldn't listen to Randi. She's just helping people to try and impress me. Whether she knows what she's talking about it debatable."


That's not very nice!

Anyway, Randi is right. So she does know what she's talking about.

There's no place like 127.0.0.1

There are 10 people in this world, those who understand binary and those who don't.
randi
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United States
Posted: 23rd Aug 2003 22:59
Oh He knows I am right, he just likes to pick on me.
He thinks it's fun.
But I pick on him too. It's this thing that we do.

Besides...
He knows that I am smarter than him.
He's drunk half the time anyway.
Fallout -->

Login to post a reply

Server time is: 2026-07-24 23:12:42
Your offset time is: 2026-07-24 23:12:42