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 / A few questions

Author
Message
Yero008
13
Years of Service
User Offline
Joined: 5th Dec 2010
Location: Romania
Posted: 28th Mar 2011 15:03
Here's the code I'm trying to learn from.

How can I make my car be already spawned in the level if I put setupCar(); before the loop it crashes, there's no floor and the car is floating, but the switching with the control key works fine.
How can I make the car spawn at a certain location? If I put other values the game crashes.
Forward thanks!
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 28th Mar 2011 17:20 Edited at: 28th Mar 2011 17:21


You seem to be using the same ID numbers for different objects, which will not work.

Also, you may be calling myPhysics.start() more than once, this could cause issues.

Overall it seems that you are mixing examples together and this is giving you issues. The examples are a guide to how you might do something, in your own project you should probably write it all yourself using the examples as a reference.

You may find this useful:



Put this in your code and use it anytime you need an ID number, this will make the examples more compatable with eachother.

iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 2nd Apr 2011 07:21
Matty, I've been trying to think about exactly the code you just wrote there....

Is it pretty much the most efficient way to get the next free id? You're a far better programmer than I, but I often have issues understanding efficiency, and just overthink things. So far, I've been doing this:



What do you think? Too much memory and object access?
iSilver
13
Years of Service
User Offline
Joined: 20th Feb 2011
Location:
Posted: 2nd Apr 2011 07:23
Forgot to post the .h

Login to post a reply

Server time is: 2024-11-19 12:16:11
Your offset time is: 2024-11-19 12:16:11