Answer» If i have this:
Code: [Select] for ( int z = 1; z < 10; z++ ){ for ( int y = 1; y < 10; y++ ){ for ( int x = 1; x < 10; x++ ){
//LOOKY HERE! You'll need this spot in a second
} } } What MATHEMATICAL action can i do between X, Y, and Z that will never return the same integer?
ex (i = total when multiplying): x = 1; y = 2; z = 1; i = 2;
but then when
x = 1; y = 1; z = 2; i = 2;
it returns the same integer... i have tried all i can think of (at least mentally) and they have not worked. Any ideas? x+(y*10)+(z*100)I...
wait... are we allowed to curse?
I -ing love you!
but i don't swing that way.
so this conversation never happened =)LOL
it actually took me a minute or so to REALIZE, that since your only GOING from 1 to 9 in the loops, you can just use the numbers as different place values.
Another thing you could do is simply use another variable, and increment it in the innermost loop and use that.Well... i don't know what you mean... here is the main part of my code i was focused on...
Code: [Select]for ( int z = 1; z < 10; z++ ){ for ( int y = 1; y < 10; y++ ){ for ( int x = 1; x < 10; x++ ){ int i = x+(y*10)+(z*100); dbMakeObjectCube( i, 1 ); } } } In DarkGDK (the framework i am using) each object is given a numerical ID to identify it, REPRESENTED by 'i' in the above code. i would have repeat integers and not get more than 30 of them on screen (i think it is thirty, didn't count, didn't BOTHER to do the math [i typed mouth at first =D ] )
i am practically trying to make a clone of http://www.minecraft.net (typed that from head, if it doesn't work just google minecraft) next thing i think i can find in the documentation, figuring out the on-screen coordinate of an object.
thanks, =)
|