Author Topic: OnTileInteraction  (Read 3204 times)

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
OnTileInteraction
« on: 2006-12-23, 02:48:31 PM »
Could someone explain some of this? I know what bNewTouch and InteractionIndex are referring to, but the other values, I'm a bit uncertain:

Sub Player_OnTileInteraction(TileX, TileY, TileValue, bNewTouch, InteractionIndex)

Out of all the projects I've downloaded, GoldYoink is the only one using this sub, and it doesn't have but 4 or 5 lines of code in it.

What I'd like to do is check the name of the category that triggers an interaction, but I don't know if that can be done. If not, I'll just check the actual tile (once I know what those first three above mean) and then the tileset.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OnTileInteraction
« Reply #1 on: 2006-12-24, 12:29:00 PM »
Since a tile can be a member in more that one category, you can't automatically map a tile to a category name.  But I can tell you what those parameters mean.  TileX and TileY indicate the column and row within the layer where the tile exists, and TileValue indicates the numeric value of that tile.  Any tile in the first column would give a TileX value of zero and any tile in the first row would give a TileY value of 0.  The numbers count up from there for each successive column/row.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: OnTileInteraction
« Reply #2 on: 2006-12-24, 01:15:32 PM »
Ah, well. Guess I'll just use some select cases to do the indexes. The thing is that we're using different tilesets on different maps, so the indexes will be different. I'll just need to check what tileset is currently active.

Ugh... looks like there's no simple way to look at the tileset as an object... Returns a "IBMDXTileSet". Guess I'll find a way to check if it's equal to another IBMDXTileSet. I'll post again if I have trouble. Thanks!

Oh, and Merry Christmas!

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: OnTileInteraction
« Reply #3 on: 2006-12-25, 07:17:26 AM »
Why not design the tilesets so that the different images for the same tile in the different tilesets have the same index?

Also, you shouldn't need to access the IBMDXTileset object.  Use the TSDef property of the layer.  It has a name property and other useful properties of the tileset.  The IBMDXTileset object is just the DirectX wrapper of the actual graphics.

eric22222

  • Fanatic
  • ***
  • Posts: 177
    • View Profile
    • Eric Online
    • Email
Re: OnTileInteraction
« Reply #4 on: 2006-12-25, 09:21:47 AM »
I've gotten it working, but instead of looking at whatever tileset is being used, I check my variable MapNum. I was already using it for stuff like creating sprites ("Player_jumping_" + MapNum). It's working, and that's good enough for me. As for making indexes the same... I mean, we could, but that'd involve alot of tile moving for not a lot of gain. I dunno, maybe we will later, but I'm content with what we've got now.