Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Collision with Tilemap Layer
#9
(04-14-2020, 02:45 PM)megamarc Wrote: That's because you're just checking collision in a single point in your character, that is not representative of its shape. To properly manage it, you should work with an array of collision points around the edge of your character, and when you move it, check all the points that are on the edge of the walking direction (if you move to the right, check all collision points on the right side of the character).

How many points and at which locations? That depends on your gameplay structure, but as a general rule, they should be separated at most the size of the tiles in the collision tileset. In your project, city tiles are 16 pixels per side, and beeb is 32, so you have to use between 2 and 3 points per side. For example [0,16,31], or [8,24]. The second set leaves a small border of 8 pixels that in some cases may feel more natural than clipping to the outer edge. In 3/4 top-down perspective -like classic Final Fantasy games-, the upper collision edge should be a bit above feet, not on the head. As I said, it depends on gameplay being created. But consider an array of points per edge.

This article may help you. It's about platformers, but the concepts about motion and collision are quite general:
http://higherorderfun.com/blog/2012/05/2...atformers/

I have tried now implementing the method you suggested, however I still am facing the same issues even when doing checks per side of the character. I even intentionally added a offset to make it detect the bottom part of Beeb rather than the full character. Do you know what could be the issue with the checks? I am sending the zip with the code. I'm also curious about configuring layers to not repeat when going out of bounds; Rather show a solid color or repeat a small pattern such as seen in the SNES. Have a good time and be safe!


Attached Files
.zip   rpg.zip (Size: 8.87 KB / Downloads: 2)
I wish you could just mov the obstacle from the destination.
Reply


Messages In This Thread
RE: Collision with Tilemap Layer - by megamarc - 04-11-2020, 04:37 PM
RE: Collision with Tilemap Layer - by megamarc - 04-13-2020, 02:59 PM
RE: Collision with Tilemap Layer - by megamarc - 04-14-2020, 03:36 AM
RE: Collision with Tilemap Layer - by megamarc - 04-14-2020, 02:45 PM
RE: Collision with Tilemap Layer - by Uneven_Prankster - 04-15-2020, 04:36 AM
RE: Collision with Tilemap Layer - by megamarc - 04-17-2020, 05:08 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)