Author Topic: Iso and Hex Tiles.  (Read 8667 times)

ETG

  • Active Member
  • ***
  • Posts: 115
  • Karma: +0/-0
    • View Profile
Iso and Hex Tiles.
« on: Tue, Feb 9, 2010 »
I thought I'd share some additions to flixel that I made.

http://github.com/ETG/flixel

And an example project to show how it can be used:
http://github.com/ETG/Example-Tilemaps

The way it works is that there is an overlap you can set that will cause the tiles to be overlapped. There is also a bool that will cause every other row to be shifted over by half a tile.

Check out the example project for some different ways to setup the maps for different types of tiles.

Collision should work as well as can be expected, but you probably won't be using the collision with these types of maps anyways.

It has been suggested I separate the hex tiles into a separate class, which might be a good idea. Let me know what you think.


And I also added a hotspot to the cursor. It's an optional parameter when you call setCursor(). So now you can have a target reticule for a cursor and have the middle part where your clicking and stuff.

bjc

  • Member
  • **
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #1 on: Wed, Feb 10, 2010 »
Oh Wow! This is awesome! (and appreciate the demo code) Love the inclusion of a hex grid! This pretty much makes flixel the ultimate engine in bringing forth the indexed colour pallet revolution! I'm waiting for Ea/Maxis to jump onto this and re-release simcity x with multiplayer/competitive building and make another bajillion dollars with the franchise.

Oh man now I'm thinking Syndicate Wars clones... Why did I have to click on this forum post... so much inspiration, so little time.

Ad Eundum Ant Nemo.
Kudos ETG

DaMaul

  • Member
  • **
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #2 on: Fri, Feb 12, 2010 »
This is great! Thank you so much for this, I was planning to do something isometric at some point in the future.

Would it be possible to extend this to enable 3d isometric levels?

Barts

  • Member
  • **
  • Posts: 61
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #3 on: Fri, Feb 12, 2010 »
Very interesting indeed! I am still toying with the idea of isometric RPG, might use it at some point. I did check the demo, it looks good (haven't really checked the code yet tho). Thanks a lot for sharing this!

ETG

  • Active Member
  • ***
  • Posts: 115
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #4 on: Fri, Feb 12, 2010 »
Would it be possible to extend this to enable 3d isometric levels?

That depends on how you wanted to do it. Got an example on the way you had in mind?

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: Iso and Hex Tiles.
« Reply #5 on: Mon, Feb 15, 2010 »
Has anyone ported this to  Flixel 2? I'm not savvy enough to port it, I tried changing the majority of the properties, but I don't know how to port:

Code: [Select]
override public function collide(Core:FlxObject):Boolean
in FlxObject, collide is calling FlxU:

Code: [Select]
/**
* If you don't want to call <code>FlxU.collide()</code> you can use this instead.
* Just calls <code>FlxU.collide(this,Object);</code>.  Will collide against itself
* if Object==null.
*
* @param Object The <FlxObject> you want to collide with.
*/
public function collide(Object:FlxObject=null):Boolean
{
return FlxU.collide(this,((Object==null)?this:Object));
}

I have no idea how to override that. :/
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

BrandonIsABadass

  • Member
  • **
  • Posts: 46
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #6 on: Tue, Feb 16, 2010 »
This is almost exactly what I was looking for.  How hard would it be to port this to version 2? 

I'm still new to flixel, but I'll give it a try unless someone smarter than me could do it.

ETG

  • Active Member
  • ***
  • Posts: 115
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #7 on: Wed, Feb 17, 2010 »
I haven't had the time to work on this. I'll probably get around to updating to the latest version of flixel this weekend.

radioact1ve

  • Guest
Re: Iso and Hex Tiles.
« Reply #8 on: Tue, Feb 23, 2010 »
Great stuff here! Any updates on the 2.0 port?

ETG

  • Active Member
  • ***
  • Posts: 115
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #9 on: Thu, Feb 25, 2010 »
I'm taking next week off and I think I'll be able to work on this during that time.
If not, it will be several months before I can work on it again.

I don't think it will take very long at all if I can just get the time to work on it.

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: Iso and Hex Tiles.
« Reply #10 on: Thu, Feb 25, 2010 »
It would be awesome if you could ETG. :)

Cheers!
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

Barts

  • Member
  • **
  • Posts: 61
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #11 on: Fri, Feb 26, 2010 »
Yes, if you have time, we would appreciate you porting it. However, it is already very nice of you to have shared it, so if you have more pressing matters, don't worry about it.

Cheers!

allenp

  • Guest
Re: Iso and Hex Tiles.
« Reply #12 on: Wed, Apr 14, 2010 »
Has anyone had time to port this to 2.x?

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: Iso and Hex Tiles.
« Reply #13 on: Thu, Jul 22, 2010 »
Bumping this. Any progress?
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

dotmick

  • New Member
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #14 on: Sun, Nov 20, 2011 »
UP

Any news of progress ?  :-[

ETG

  • Active Member
  • ***
  • Posts: 115
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #15 on: Sun, Nov 20, 2011 »
No progress at all.

Honestly I can't figure out a simple and elegant way to handle the collision.


If I pick the project back up I think I would do it as a flxComplexTile class that would do iso/hex, slopes, animation, and custom collision routines. Maybe have some sort of dictionary of tile indexes and collision functions lookup? I don't really know.

dotmick

  • New Member
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Iso and Hex Tiles.
« Reply #16 on: Mon, Nov 21, 2011 »
I understand.

For the collision, what about a pixel perfect one ? Could be maybe easier, what do you think ?

What about this post about the system used by DAME http://forums.flixel.org/index.php/topic,5035.0.html ?