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 / 2D Game for GDKNET

Author
Message
Molex
16
Years of Service
User Offline
Joined: 11th Mar 2008
Location:
Posted: 16th Dec 2008 15:40
I was practicing code to make a 2d asteroid game but I am having trouble with it being a 3d world. I gather the screen is divided up into the four quadrants?
I was trying to place asteroids randomly across the screen but it puts them in the upper-right of the screen. There an easy way to make screen just with one quardrant? Like 0,0 being lower left or such? I've tried moving the camera but I'm not sure that is best way.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 16th Dec 2008 17:13
Quote: "I gather the screen is divided up into the four quadrants? "

Not sure what you mean by this, could you show some code.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 16th Dec 2008 18:42
You're assuming that the x=0, y=0 coordinate is at the center of your screen. It's not. It's in the upper left corner with the x-value increasing to the right and the y-value increasing downward. This is standard for any graphic representation unless you adjust your program to make the corrections.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Molex
16
Years of Service
User Offline
Joined: 11th Mar 2008
Location:
Posted: 17th Dec 2008 01:17 Edited at: 17th Dec 2008 01:26
I'm not assuming or did I break it up this way. Based on what the GDK template code its placing objects that are position 0,0,0 in middle of the screen.
Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Dec 2008 16:36
What I do if im making a 2D (top-down) game in a 3D world, I place the camera at (0,someHighNumber,0) and then face the camera down toward (0,0,0).
Then you can think of the game as 2D by keeping the Y-value at 0 for all objects at all times, then you have your 4 quadrant view using the X and Z co-ordinates only, to move and manipulate in-game objects.

NOTE: the higher someHighNumber is, the bigger the X and Z values will have to be (negative and positive) for your objects.
Also when you randomize, make sure you have full range of negative and positive numbers in your dbRND(), eg for a screen where X ranges from -100 to +100, use dbRND(200)-100;
Molex
16
Years of Service
User Offline
Joined: 11th Mar 2008
Location:
Posted: 17th Dec 2008 22:04
Good ideas matty, I'll give them a try. Thanks.

Login to post a reply

Server time is: 2024-09-30 13:19:19
Your offset time is: 2024-09-30 13:19:19