Right, I'm trying to use this tutorial (translating all of the code into C++/DarkGDK obviously): http://developer.thegamecreators.com/?f=t01/3d_tutorial_3
And I'm having trouble with the following lines:
For x = 1 to 5
Make object cube x,100
Position object x,Rnd(2000),0,Rnd(2000)
Next x
Which I have translated to:
for ( int x = 0; x < 5; x++ )
{
char buffer[2];
dbText( 0,x*10, itoa(x, buffer, 10) );
dbMakeObjectCube( x, 100 );
dbPositionObject( x, dbRnd( 2000 ), 0, dbRnd( 2000 ) );
}
You've probably noticed that I've added in the lines outputting numbers to show how many loops have been completed.
The result is just a blank screen with the number "0" in the top left. From mucking around a bit with this code aswell I've found that it just stops ob the line:
dbMakeObjectCube( x, 100 );
However, if I replace the whole thing with simply:
dbMakeObjectCube( 1, 100 );
dbPositionObject( 1, dbRnd( 2000 ), 0, dbRnd( 2000 ) );
then it works perfectly (well, it only creates one cube obviously).
So why does it not work in the loop?
As far as I can see I've translated from the tutorial exactly?
Cheers in advance.