Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (754) Games in Android Showcase (229) games submitted by our members Games in WIP (842) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Home Help Search Login Register
Pages: [1]
 ignore  |  Print
 Isometric Grid - Tiles as objects  (Read 3457 times) 0 Members and 1 Guest are viewing this topic.
jh62

Junior Devvie

Medals: 3
Projects: 1

 « Posted 2013-05-30 05:43:01 »

Hi!

I'm trying to learn about Isometric projection and so far I understand the concept, but the mathematics I saw are a little confusing. Seems like everybody has it's own way of doing them: some are complex, some are simple...

I came up with my own way of drawing into a isometric grid, but the real challenge is mapping the mouse coords to the individual cells in the grid.

I never saw this done (don't know why), but I made every tile on my grid an object with a polygon surrounding it's boundaries and I think is pretty simple and straightforward, because I only need to check if mouseX & mouseY are inside them.

Don't know about a full game using this method, but so far it's fast and reliable.

I'm still trying to learn the "usual" way to do it, anyway...

hellrazer21

Junior Devvie

 « Reply #1 - Posted 2013-05-30 06:04:43 »

well i know one way of doing it is to use libgdx
heres an example https://github.com/libgdx/libgdx/blob/d0de5843edd4c9c4903188b203a9a3e098840b12/tests/gdx-tests/src/com/badlogic/gdx/tests/TiledMapAssetManagerTest.java

if your making it from scratch i cant help much with that

actual

JGO Coder

Medals: 25

 « Reply #2 - Posted 2013-05-30 06:05:54 »

Quote
... I think is pretty simple and straightforward...

I think you answered your own question :).

Making each tile an instance of a class makes sense and it looks like you have a reasonable and workable solution so I would stick with what you have unless some issue (performance, complexity, etc) forces you to change.

If you are still wondering if you have the right approach, it is worth thinking through a couple of scenarios that you plan for your game to see how well your current set up will handle it.
1. Will the player be able to rotate the board as a whole and/or zoom in and out? If so, do you think your current set up will be able to handle it?
2. When you have things on the tiles (units, buildings, whatever), will your setup be able to handle that. For instance, if the top of a building overlaps with a title and the player hovers over it, will your setup be able to detect that?

As an aside, I like the idea of the volume of the tile being highlighted as you hover over it (maybe as a colored translucent cube borderless cube).
 Games published by our own members! Check 'em out!
jh62

Junior Devvie

Medals: 3
Projects: 1

 « Reply #3 - Posted 2013-05-30 06:10:29 »

As an aside, I like the idea of the volume of the tile being highlighted as you hover over it (maybe as a colored translucent cube borderless cube).

That's how X-COM: UFO Defense does it, hehe. Not my idea.

Thanks for the input. It's too early to tell what you asked, since I'm first trying to master everything I need to do for my game before actually doing it.

About the zoom: with AffineTransform i can easilly zoom in and out and everything keeps in place. I was messing around with it yesterday and it's awesome. I'll have to check it out with an actual game running.

I'll make a similar game as UFO Defense, just for the sake of practice. It's an awesome game.

jonjava
 « Reply #4 - Posted 2013-05-30 15:16:38 »

There's no "usual" way. There are just ways that work and don't work. What's key is how you separate logic, data and graphics. And two of those three have nothing to do with isometric projections at all.

jh62

Junior Devvie

Medals: 3
Projects: 1

 « Reply #5 - Posted 2013-05-31 04:44:49 »

There's no "usual" way. There are just ways that work and don't work. What's key is how you separate logic, data and graphics. And two of those three have nothing to do with isometric projections at all.

I just got curious because I didn't see this simpler approach done in the many tutorials I've seen on the internet.

Pages: [1]
 ignore  |  Print

 DesertCoockie (20 views) 2018-05-13 18:23:11 nelsongames (68 views) 2018-04-24 18:15:36 nelsongames (65 views) 2018-04-24 18:14:32 ivj94 (748 views) 2018-03-24 14:47:39 ivj94 (79 views) 2018-03-24 14:46:31 ivj94 (563 views) 2018-03-24 14:43:53 Solater (94 views) 2018-03-17 05:04:08 nelsongames (168 views) 2018-03-05 17:56:34 Gornova (346 views) 2018-03-02 22:15:33 buddyBro (1006 views) 2018-02-28 16:59:18
 Java Gaming Resourcesby philfrei2017-12-05 19:38:37Java Gaming Resourcesby philfrei2017-12-05 19:37:39Java Gaming Resourcesby philfrei2017-12-05 19:36:10Java Gaming Resourcesby philfrei2017-12-05 19:33:10List of Learning Resourcesby elect2017-03-13 14:05:44List of Learning Resourcesby elect2017-03-13 14:04:45SF/X Librariesby philfrei2017-03-02 08:45:19SF/X Librariesby philfrei2017-03-02 08:44:05
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org