Search | Statistics | User Listing Forums
XNA Resources
XNA Resources ->  General Discussion -> XNA Resource News -> View Thread

You are logged in as a guest. ( logon | register )

Tile Engine Tutorial Series : Isometric Picking
Jump to page : 1
Now viewing page 1 [25 messages per page]
View previous thread :: View next thread
   General Discussion -> XNA Resource NewsMessage format
 
Kurt Jaegers
Posted 2011-04-10 8:49 AM (#268)
Subject: Tile Engine Tutorial Series : Isometric Picking


100100252525
I've been wrapped up in some Windows Phone 7 development for a while now (and really still am) but I wanted to go ahead and post the next installment of the Tile Engine Tutorial series as it has been mostly finished for a while.



This time around, we look at converting an X/Y coordinate (in screen terms) into a tile coordinate on the map. This tutorial looks at using the mouse to select tiles on an isometric map. The same technique applies to hexagonal maps as well.



The next installment will look at putting an animated character on the map, and relies on the code developed here to properly position the image as the character moves around the map. That installment should be arriving in the near future, but no absolute promises!



Check out the tutorial on the Tutorials Page or via the direct link.

Top of the page Bottom of the page
Ian
Posted 2011-04-25 12:32 PM (#271 - in reply to #268)
Subject: Re: Tile Engine Tutorial Series : Isometric Picking


New user

Posts: 1

I remember reading that a Binary shift would work as well, somwhere. Something like

public Point RealToIso(Point original)
{
int ix = original.X;
int iy = original.Y;
Point p = new Point((ix + iy) >> 1, RealWidth - ((RealWidth + iy - ix) >> 1));
return p;
}
// realwidth = width of box;


public Point IsoToReal(Point original)
{
int vx = original.X;
int vy = original.Y;
return new Point(
vx + vy - RealHalfLength,
vx + (length - vy) - RealHalfLength);
}

RealHalfLength is the greater of width or height of the box, divided by 2



Really looking forward to the next part in the series!

Edited by Ian 2011-04-25 12:33 PM
Top of the page Bottom of the page
AlexPGilbert
Posted 2011-04-26 9:25 PM (#272 - in reply to #268)
Subject: Re: Tile Engine Tutorial Series : Isometric Picking


New user

Posts: 1

The placement of the hilighted tile is out of place when firstY is odd. I am trying to figure out a fix right now. I'll post later if i figure something out. You can see the error if you move the camera down to where the first tile is 0,1. You'll notice that the hilighted tile is off with the grid.
Top of the page Bottom of the page
Kurt Jaegers
Posted 2011-05-04 4:52 PM (#288 - in reply to #272)
Subject: Re: Tile Engine Tutorial Series : Isometric Picking


100100252525
You are definitely right about the hilight placement bug when the offset is incorrect... I'm working on a fix for that, though it might take a few days before I have time to work it out.
Top of the page Bottom of the page
Jump to page : 1
Now viewing page 1 [25 messages per page]
Jump to forum :
Search this forum
Printer friendly version
E-mail a link to this thread

(Delete all cookies set by this site)
Running MegaBBS ASP Forum Software
© 2002-2014 PD9 Software