Advertisement Jump to content


This topic is now archived and is closed to further replies.


Depth in 2D: A few questions and ideas...

This topic is 6397 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I''ve decided to start working on a 2D shooting gallery style game, but with a few differences from the usual style. Firstly, I want there to be real depth between the player and the enemies, so bullets actually whizz to and fro, etc. However, the depth the enemies occupy is still only one single "layer" (well maybe a few for scenery and such, but they basically don''t wonder around freely), so basically if you took out the depth it would simply be a flat 2d shooting gallery game again. Secondly, unlike in things like duckhunt where the whole screen / camera was "you", in my game the player is going to be situated a few units infront of the camera, basically lying down peeking over the edge of a verge, with the ability to shuffle along from side to side, and duck down the verge to dodge the hail of incoming bullets. Anyway, before I start work on this project, I want to make sure it is within my grasp - my last one was far too ambitious, but this one I think I can do. The idea of depth niggles me though. I think I can manage it, but I though i''d ask for ideas before I dive in. My question basically is how should I go about implementing the depth in the world? I''ve toyed with raycasting before, and thought I could use the same method of getting the projection plane, but i''m not sure. I''ve also done part of a 2d footy game, so i''ve also dealt with 3d coordinates in a 2d world (when the ball gets kicked into the air). However, I can''t think of how i''d manage it in this situation. I''d clearly have to keep a set of real world coordinates and translate them to screen coordinates. Also, x = 0 would have to be the center of the screen, as would y. It''s all sounding like it''s getting far too 3D for my liking . Can such an effect be acheieved in 2D? I''m sure it can... bullets slowly coming towards you then whizzing by. In a way I guess i''m talking about something not too dissimilar to microsoft''s flying stars / windows screensavers. You know the ones. Anyway, sorry for the long winded post - I still don''t think i''ve hit my point, but if anyone can make any sense of what i''m babbling on about, any reply with ideas / solutions / past experience would be highly appreciated . Insomnia

Share this post

Link to post
Share on other sites
It seems pretty simple to me... you''re gonna need some sort of 3d positioning anyway, so may as well just use 3d vectors to represent this. Then, since you have a fixed viewpoint, it''s just 1 simple projection equation to take a 3d point and make it into a 2D one.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!