Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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 1183 times)
0 Members and 1 Guest are viewing this topic.
Offline jh62

Senior Newbie





« 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.

What do you think about this? Any recommendation?

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



Offline hellrazer21

Junior Member





« 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

Offline actual

JGO Coder


Medals: 23



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

What do you think about this?

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!
Legends of Yore - The Casual Retro Roguelike
Offline jh62

Senior Newbie





« 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.
Offline 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.

Offline jh62

Senior Newbie





« 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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (37 views)
2014-09-24 16:13:29

Pippogeek (29 views)
2014-09-24 16:12:22

Pippogeek (18 views)
2014-09-24 16:12:06

Grunnt (42 views)
2014-09-23 14:38:19

radar3301 (24 views)
2014-09-21 23:33:17

BurntPizza (61 views)
2014-09-21 02:42:18

BurntPizza (30 views)
2014-09-21 01:30:30

moogie (36 views)
2014-09-21 00:26:15

UprightPath (49 views)
2014-09-20 20:14:06

BurntPizza (52 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!