It is currently Sat Oct 19, 2019 2:30 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: 2D tile game question
PostPosted: Thu Jan 23, 2014 9:04 am 
Offline
User
User
User avatar

Joined: Tue Mar 10, 2009 9:09 pm
Posts: 57
Location: Shakopee, Minnesota. USA
I'm totally new to the graphics end of programming and I have a question regarding layering of tiles and how it works exactly. I'm going to be having sprites going inside of buildings and under bridges but I'm not sure how to layer the tiles to be able to do that. I searched the forum for layering tiles but didn't come up with much. Any help would be greatly appreciated.

_________________
Windows 7 Ultimate x64 / PureBasic 5.21 LTS / ProGUI Platinum / PureVision / http://www.linkedin.com/groups/PureBasic-Professionals-4463282?gid=4463282&mostPopular=&trk=tyah


Top
 Profile  
Reply with quote  
 Post subject: Re: 2D tile game question
PostPosted: Thu Jan 23, 2014 3:59 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1998
Location: USA
Read all of this topic. There is a layer example. ;)

http://forum.purebasic.com/english/view ... a1985763d3

_________________
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef

Mac: 10.13.6 / 1.4GHz Core 2 Duo / 2GB DDR3 / Nvidia 320M
PC: Win 7 / AMD 64 4000+ / 3GB DDR / Nvidia 720GT


Even the vine knows it surroundings but the man with eyes does not.


Top
 Profile  
Reply with quote  
 Post subject: Re: 2D tile game question
PostPosted: Thu Jan 23, 2014 11:53 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Feb 12, 2006 10:06 pm
Posts: 638
basically it comes down to the order you display the sprites to the screen - later sprites would appear to be on top of earlier sprites.

so, for a three layer display:
1) display all your background sprites
2) display all the character/object/wall sprites
3) display all the "overhead" sprites

should do the trick

_________________
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat


Top
 Profile  
Reply with quote  
 Post subject: Re: 2D tile game question
PostPosted: Sat Jan 25, 2014 8:22 pm 
Offline
User
User
User avatar

Joined: Tue Mar 10, 2009 9:09 pm
Posts: 57
Location: Shakopee, Minnesota. USA
I thank you for the info. I'm not completely understanding how this works but I will figure it out.

_________________
Windows 7 Ultimate x64 / PureBasic 5.21 LTS / ProGUI Platinum / PureVision / http://www.linkedin.com/groups/PureBasic-Professionals-4463282?gid=4463282&mostPopular=&trk=tyah


Top
 Profile  
Reply with quote  
 Post subject: Re: 2D tile game question
PostPosted: Thu Mar 20, 2014 5:04 am 
Offline
Addict
Addict

Joined: Sun Dec 12, 2010 12:36 am
Posts: 1617
Location: Somewhere in the midwest
UUICEO wrote:
I thank you for the info. I'm not completely understanding how this works but I will figure it out.


Think of it this way. When you build your Procedure that will draw/redraw your graphics to update the scene, all you have to do is draw them in the proper order, or Z-Level. Even though 2D sprite/tile games use simple X/Y coordinates, you still need to take Z coordinates into consideration, because the Z axis controls the depth at which an object is drawn. That is, how "deep" it is in the scene.

Think of it as like Disney's early animation technique of using a multi-plane camera. By positioning traditional animation cels at various positions, and controlling how and when they move, you can simulate a 3D / Parrallax effect which can give you depth of field and make a scene feel 3 dimensional.

So let's say you have a scene you want to build. You have a town square and in the center of it is a fountain. We have some shops and houses as well, some outdoor picnic tables, trees, the road is cobblestone and it cuts through large patches of green grass, with various flowers, bushes and shrubbery growing out of the ground..

The first thing you draw onto your screen buffer would be all the ground tiles. That would be grass, cobblestone for the street, perhaps some other mixed tiles showing different textures of grass, specs of dirt or flower patches, etc. If you had a stream running through the town, you might place those water related tiles as well.

The second thing you draw would be your "props" layer. Mostly this will consist of things like your Trees, Houses, Shops, fences, shrubs and bushes, picnic tables, and things like that.

The third thing you draw would be your characters, and perhaps some other props that need to be drawn on top of everything else. Like say a horse and buggy traveling through the town.

Part of what you draw and what layer it is in will also depend on any special effects you might want to do, relating to things like which tiles are passable or not passable, or if for example you want to make your character pass "behind" a tree as he runs through the area, or you want to make sure he is not covered by the tree sprite when he runs in front of it.

2D Tile based games may appear simple, but they can be very complex and can deal with a lot of different problems in their own unique way; this was just a very simplified overview of what you want to consider when setting up your drawing order for sprites

_________________
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye