Getting a specific tilemap tile with collision + adding custom data (Paper2D)

  1. How do i get the specific tile the player is colliding with? right now the all that is returning is the tilemap object and i can’t seem to find a way to get the specific colliding tile.

  2. Ties into question 1 The main issue is i want to add teleporting tiles so i need the ability to add custom data to a tile. Anyway to do this? I want to be able to select a tile in the tilemap and assign it a class or an object to use as its additional data.

  3. Is it possible to animate tiles in a tilemap?

If there is a way to do this in C++ that is fine as well.

I don’t know if you can make out which Collision you collided with, but I did a Pokemon “clone” a while ago, just to test how paper2D works
and I must say it’s a pain.

If I recall correctly, everything that needs logic, such as a teleporter, needs to be placed by hand and can not be done with the TileMap.
This also includes animated sprites.

Here is what I’ve created back then:

Afaik, the flowers, the doors, the teleport, the NPCs, every single thing that is not a static tile or blocking volume is an extra actor I placed by hand.

Well that sucks but at least i can continue with my work and stop investigating into how to accomplish this. Thanks eXi

I’m pretty sure I did something before that you can trace which tile you’re ontop of but yes it requires a bit extra work. you gotta make yourself an index (think of it in the same way of making an index for a database.) or kinda like a look up table and based off that you can return the tile you’re on.

here’s a tweet I posted of the results but honestly I do not for the life of me remember how I did it exactly.

If I do recall it, I’ll see what I can do to post up the process.

that would be great thanks

So i took your idea about saving an index and did the following:

  1. Added a user tag to a tile to indicate its a starting tile
  2. when the player spawns check all tiles for the starting tile, save its index and place the player there
  3. Since my movement is tile based i update the tile index when the player moves

Giving some thought what I ended up doing, if I remember correctly:

  1. I created Structure blueprint.
    a. This structure had a Range Start (vector) Range End (vector) Tile X and Tile Y (both integers)
  2. I created a Tilemap in a blueprint and on begin play a double for loop would scan the tilemap on X and Y, Get Tile Polygon (so I can get all 4 corners) and calculate the start point and end point of that tile then add that to the structure (start range, end range) and then store the positional data of that tile in the Tile X and Tile Y (into an array of tiles.)

With that done, my character would then call a function that sent the vector data of character(world position) and see if it was within the same vector position (not Z, though.) through a for loop of the array of Tile Data (structure). I had to be less than the end range and greater than the start range with a little extra checkers to make sure I was accurate.

Not sure how efficient this would be and maybe your method is much more efficient in the sense.