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.

Dark GDK / Create Some Boxes (Noob Questions :) )

Author
Message
Menethil
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 8th Aug 2010 21:27 Edited at: 8th Aug 2010 22:36
I'm really newbie at DarkGDK . I try to make a build game.

I want when i press space create box at box1(x,y,z) i try this code :

In LoopGDK :



And i create int i ; out of LoopGDK .But when i try to run it.

When i press space the box not created at box2 position.Box created at front of camera.But i want when i press space create a new box at box2 position and when i press space again not delete another box. Please help me


Sorry for bad english.I'm from Turkey
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 8th Aug 2010 23:14 Edited at: 9th Aug 2010 00:31
bugged thread, i see nothing, once again =/

EDIT ok thread is working

it's because auto cam is on, the box is actually in the place you want but the camera is shifted to face it, so all you need to do is to put dbAutoCamOff ( ) before your loop

also, this code is not perfect, while space is pressed, it will keep creating new boxes as long as the loop's alive, you press the space for like 0.5 sec, and since the app is 60 FPS (i suppose?), then you will create at least 30 boxes in one very fast space click, solution would be to do something like this:

this will wait until the space key is pressed then released, then it will create the box

Menethil
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 8th Aug 2010 23:17 Edited at: 9th Aug 2010 00:10
What should i do Hassan ? Please help..
Menethil
14
Years of Service
User Offline
Joined: 8th Aug 2010
Location:
Posted: 9th Aug 2010 00:13
if(dbSpaceKey()){
i++;
dbMakeObjectCube(i,5);
dbPositionObject(i,dbObjectPositionX(2),dbObjectPositionY(2),dbObjectPositionZ(2));
dbTextureObject(i,3);

}

Login to post a reply

Server time is: 2024-11-19 20:33:12
Your offset time is: 2024-11-19 20:33:12