Author Topic: Getting information from collision of tileMap  (Read 1601 times)

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Getting information from collision of tileMap
« on: Wed, Dec 30, 2009 »
Is there any way of getting information of a specific collided tile? Or is the tilemap treated as a whole? Sort of like one big bitmap?

Or should I just build my levels with blocks to be able to interact with them?
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

Rybar

  • Contributor
  • ****
  • Posts: 279
  • Karma: +0/-0
    • View Profile
Re: Getting information from collision of tileMap
« Reply #1 on: Fri, Jan 1, 2010 »
Have a look here:

http://flixel.org/docs/org/flixel/FlxTilemap.html#setCallback%28%29

Tiles are treated individually, and from what I've read, are a better choice for large maps because they're optimized for collisions (only tiles on screen are collided during the game loop). Setting up interaction for FlxBlocks and Sprites is a litle more straightforward I think, so maybe you stick with your tilemap and use FlxBlocks or sprites in places they're needed (Moving platforms, spikes, etc).  I haven't done much with tilemaps, so someone jump in here and correct me if I'm wrong.

zuperxtreme

  • Contributor
  • ****
  • Posts: 254
  • Karma: +0/-0
    • View Profile
    • Buddah
Re: Getting information from collision of tileMap
« Reply #2 on: Sun, Jan 3, 2010 »
Woah, nice documentation. Thanks a ton, for the answer and the link.  ;D
..."without order nothing exists, without chaos nothing evolves"... 
Zoklet.net

photonstorm

  • Administrator
  • Key Contributor
  • *****
  • Posts: 1502
  • Karma: +1/-0
    • View Profile
    • Photon Storm
Re: Getting information from collision of tileMap
« Reply #3 on: Sun, Jan 24, 2010 »
One thing I'd just like to add - because it caught me out big-time less than an hour ago - setCallback functions don't fire unless you run collide() on your map each update.
http://www.photonstorm.com



"Tell me and I will forget, show me and I might remember, involve me and I will understand" - Confucius