Jump to content

Arcade Physics and colliding to two tiles at the same time


Noid
 Share

Recommended Posts

If I have a sprite standing on top of two tiles like this: 

 

zmBAbC3.png

 

The collision code will always return the one on the left as the collided tile even if most of the hitbox is standing on top of the one on the right. 

I want to make my character react differently based on what tile it bounces off, but players get confused when the character is bouncing mostly off a tile type A and the reaction corresponds to a tyle type B that it was barely touching. 

Link to comment
Share on other sites

I think that it's how games work though : if you touch tileA, even just a bit, then you benefit from whatever tileA's bonuses are. Is it not a problem with your body instead? On your picture the body of your character is very different from the real, visual look of the character, and this is going to create confusion, for the tiles or for hitboxes. (but I guess that if it is that flat, it's because it is currently boucing?)

Link to comment
Share on other sites

  • 2 weeks later...

I think that it's how games work though : if you touch tileA, even just a bit, then you benefit from whatever tileA's bonuses are.

Is it not a problem with your body instead? On your picture the body of your character is very different from the real, visual look of the character

Ignore the sprite image, I'm talking about the body. If you touch tileA with the body even just a bit it considers that you're standing on tileA, but ONLY if you're coming from the right since the contact point is only the bottom-left of the sprites body. That means that if you're coming from the left you can have 99% of the sprite's body on top of tileA and it won't count since the bottom left of it is not touching the tile. 

This is very confusing for players since they don't understand why they sometimes get a bonus when they're barely touching a tile and sometimes they don't get it even with most of the sprite standing on it. 

 

I've manage to fix it adding a collision callback. If the body is onFloor and not onWall I get the tile immediately below the body bottom center and if I get a tile that has collidesUP set to true I use that for the bonus. 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...