2D Tiled Map in C# (Top-down / Isometric)

Eventually this post will contain useful information!

Page 1 of 1

0 Replies - 13632 Views - Last Post: 15 February 2008 - 07:20 AM Rate Topic: -----

#1 Samuraiken  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 3
  • Joined: 19-July 06

2D Tiled Map in C# (Top-down / Isometric)

Posted 15 February 2008 - 07:20 AM

(just an FYI, i read This post and it just died off with no real answer)

Good evening!

I created a game a long time ago in Visual Basic 4, and started to upgrade it to Visual Basic 6 shortly after that was released but let the project drop off. However since i mainly use c# at work, and hardly remember any VB, I've recently decided to create another game based on the same concept, however i'm not certain if it's going to be an RPG or RTS. As of now, it doesn't really matter because of my extremely "noobish" problem...i don't know where to begin to display maps, both your normal every-day 2D map, nor it's Isometric counterpart. I *really* want to go with an Isometric map...normal top-down 2D drives me batty for some reason.

Assuming i had tiles created (i have 4), i would like to have a 32x32 map displayed on the screen, with each tile being 128x64 in size. I've been trying to use DirectX 9 to do this, and dipped into the XNA Game Studio Express, but have no idea how to start implementing this (All the XNA GSE did was set up my device for me, which i was eternally grateful for).

I thought that i would just create an array, and fill it with whichever number i was using for tiles (an example being:
1 = grass; 2 = dirt; 3 = water; 4 = mountains).

Now, i've created a standard form just to make sure this would work (with movement), by having four buttons (up/down/left/right) that i can click and it would move my "position" on a grid. Really, it was only two labels, on for X = and the other for Y =. So for instance, [0,0] is the upper leftmost corner of my standard visual c# form, and i clicked the "right" button, my labels now show: "X = 1 , Y = 0".

But as far as actually displaying the tiles, i have no idea how to do this.
Do i create a loop that filters through each X,Y position in my array, and displaying the preferred tile...and then taking the top-left corner of that current tile (which i'd assume would be 0,0 at the start of loading), and say
xPos += 128;
yPos += 64;

to add with width of a tile (128) to the current tile's "origin", which would give me where the next tile would be?

I'm also extremely stuck on how to set my screen witdth/heigh, at that (ie, how DO i create a form on the screen that is 4096x2048 rather than the normal window that it gives me (i don't have an exact size for it, sorry).

If anyone can help, it would be greatly appreciated!
And if you can just create a tile or two and actually make it, Paypal donations to you ^^ :blink:


Attatchments:
Actually, here are two tiles that i found online, which i'm using to try to test this out. These are actually 256x128, as i was actually trying to do an 8x8 grid at first. However, i haven't even been able to load anything up yet. I could post the default XNA code if needed, let me know...i just didn't want the post to be any longer than it is!

Attached image(s)

  • Attached Image
  • Attached Image

This post has been edited by Samuraiken: 15 February 2008 - 07:24 AM


Is This A Good Question/Topic? 1
  • +

Page 1 of 1