Sign in to follow this  
farooqaaa

[XNA] 2D Point and click games - how do they work?

Recommended Posts

farooqaaa    100
I am interested in making a 2D point-and-click game but I am confused. How is the scene set up graphically and programitically? (I'm a programmer)

Here's my take:

So I've this test character:

[img]http://i.imgur.com/UObwD.png[/img]

And here's a test scene (its a wallpaper):

[img]http://i.imgur.com/Ld4Iv.png[/img]


I want the character to walk through that bridge and I want it to look real.

To do that I've cropped this from that picture:

[img]http://i.imgur.com/MqiW4.png[/img]


And added it above the original picture. Now I've added the character in the middle of these two pictures.

And I've accomplished this:

[img]http://i.imgur.com/pAL1n.gif[/img]


Am I doing it right? Will I have to save both images separately?

[b]P.S: I'll be using XNA.[/b]
[b]
[/b]
Thanks

Share this post


Link to post
Share on other sites
SuperVGA    1132
Yep, that's just about how I'd do it if i had a static scene like that.
(Of course, the cropped tree and bridge image is missing a bit of transparency, but it's just an example, right. :) )

You could have the tree as a separate image, the bridge as a separate image, and associate each image with a depth value.
I recommend making a simple editor that allows you to import objects to different layers, setting their offset inside their respective layers, and scaling them etc.
This will also allow you to give the tree some parallax coefficient, so the foreground would be scrollable at a different pace relative to the rest of the scenery.

You don't need to save the images separately, but I'd make a set of files each with its own category or theme of images. Then if you need to use the tree several places in one scene,
or in multiple scenes, you can easily just get it no matter what level or where in a level it's supposed to be.

In case this is not a quick draft of how you'd imagine assembling things, i apologize. I haven't really messed much with scenes composed and stored as single images.
Composition of a scene allows you to create a fair amount of variation and new places easily.

Share this post


Link to post
Share on other sites
MichaelDwan    322
Alternatively to cutting the image up and layering it, you could use a pseudo depth buffer as well. In it you would have key-values (graphically for editing you could use something like Magenta or some other stand-out color), then, when drawing your sprites, check the buffer at the sprite's position and don't draw anything that collides with the Magenta value.

Just a thought. I do think it would be more difficult to implement this efficiently than just layering, but, from a development standpoint it it would be quicker and simpler than chopping all your map screens up in randomly sized chunks.

Share this post


Link to post
Share on other sites
SuperVGA    1132
[quote name='farooqaaa' timestamp='1310848321' post='4836128']
I am not that good with XNA. How does depth buffers work? I Googled it but couldn't find any useful tutorials.
[/quote]
Well alright, then perhaps The Doc's suggestion about the pseudo-depth buffer would actually be the way to go.
Otherwise, have a look at this very basic XNA article: [url="http://xna-uk.net/blogs/grannysbest/archive/2010/02/16/depth-z-buffers.aspx"]http://xna-uk.net/bl...-z-buffers.aspx[/url]
Perhaps that will give you some ideas...

Also, we're talking about "layering" stuff here, right? As far as the technique you're using now, it looks just fine.

Share this post


Link to post
Share on other sites
SelethD    456
I am not the OP, but I am having sort of the same issues with a game im trying to make.
I need to have a real Depth Buffer in XNA, but cant find anything that really explains them.

I went to the suggested link, and though I understand the concept, is there anything that tells where to put the different commands?

Do they go in the Render fucntion, or the Load, or Init ?

Does anyone have a simple example they would be willing to share, something showing just how to set up a depth buffer in a clean xna project?

Thanks

Share this post


Link to post
Share on other sites
SuperVGA    1132
[quote name='Tom Sloper' timestamp='1311134980' post='4837785']
Should this be in the XNA forum? Just asking...
[/quote]
[font=arial, verdana, tahoma, sans-serif][size=2]Well, I can only help finding resources, as I don't have any XNA experience myself.
The OP was quite general at first, but I think now the thread would be better off in the XNA forum...[/size][/font]

Share this post


Link to post
Share on other sites
cmasupra    145
XNA has 3 overloads of SpriteBatch.Draw() that include a depth argument. Here is one of them: http://msdn.microsoft.com/en-us/library/ff433992.aspx

Here is a list of all the SpriteBatch.Draw() overloads: http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.graphics.spritebatch.draw.aspx

For the depth, you enter a value between 0 and 1. 0 is the front, 1 is the back. 0.5 would be in the middle.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this