quote:Original post by VertexNormal
Well, thank you. I'm glad to be of help. I actually tend to look on topics that I am truly interested in such as this as an excellent opportunity to try to develop my writing skills, and to work on my ability to explain things as clearly as I can. I also love games in the isometric format, and if by trying my best to help people learn, stay motivated, and complete their projects can help the isometric "genre" to thrive and grow among the hobbyist community, then I am more than glad to spend a little time. I might not always be right, but I am willing to try to help when I can.
Of course, I don't know how the whole "Vertex for President" would work out; things like that tend to go straight to my head. You have no idea of the absolute monster I could turn into.
Anyway, I'm looking forward to seeing what you figured out. Good luck.
Hey,
Well, most presidents look nice, and turn into monsters once they have the power
I'm glad to see that you are trying to keep the isometric community 'standing'. I'm now busy with a tutorial about the isometric basics, and I will make more tutorials when I counter more problems or hard developing parts, I will also make them as much 'language independent' as I can and I might add some C/C++ (and ofcourse Java) code listnings, as example.
About my idea I hope that noone has posted this, then I would look like a fool. Because my english isn't that good, I didn't understand all the tutorials, so if I stole your idea, don't blame me!
I have figured out a simple way to get the tile where someone has clicked on, using a mousemap.
The Theory I make a square grid around the isometric tiles. (not really, just in my head) Like this:
**A square is not an isometric tile, but a square tile (which is also 64x32)**
Ofcourse, it's easy to get the square where someone has clicked. So after you get the square where was clicked, you only need to translate it into the according isometric tile. After a couple of hours sitting, staring, eating and bang-head-to-table I have found the formula to translate a square into a tile. So this is what I do:
+Translate the Mouse coordinates to the Square coordinates
+Translate the Square Coordinate to the Isometric Tile.
Simple example (this is probaly not correct, jsut to show how it works)
You clicked on the screen coordinate: 125,435.
You translate it to the Square coordiante: 6,9.
Now you translate it to the Isometric tile: 3,4.
Et voila , you got the isometric tile.
I hope this still sounds understandable, if not I will try to make some images to explain it better.
The code Now off to the important thing; the actual formulas.
How to translate a clicked coordiante to an square? That isn't to hard, that's just like getting a tile with an top-down view.
*note* I base my whole map that gets drawn on the center tile, so you can easly change which piece of the map gets drawn.
This isn't actual code, I removed things like variable declaretions and the ";" (that would only make it harder to read)
sqX=mouseX+topCoordinateX
sqY=mouseY+topCoordinateY
**The numbers (64 and 32) are the width and the height of one tile (Square and Isometric)**
sqX=sqX/64
sqY=sqY/32
tileX=sqX-centerTileX+sqY
tileY=sqY+centerTileY-sqX
Variable Explaination
sq(X/Y) the square where someone has clicked on (Not the Isometric Tile)
tile(X/Y) this is what we want to know, the Isometric Tile where someone has clicked on
topCoordinate(X/Y) this is the left upper pixel coordinate, from where you start drawing. Also called the 'offset' I believe (not sure, so I wouldn't name it like that)
centerTile(X/Y) the center tile of the map you
drawed , not the center of the whole map(this tile could basicly be every tile)
After you got the tile, you need to use the mousemap to change the tile.
I hope this has explained some stuff. If you want, I can post the Java source.
I hope this is understandable, as you can see, I'm also trying to develop my (English) writing skills
Have a good day!
Wesley
[edited by - wicked_Wesley on November 28, 2003 2:06:05 PM] [edited by - wicked_Wesley on November 29, 2003 2:24:28 PM]