Landing Bug?

ozz

  • *
  • Posts: 557
I have a behavior that works pretty good for registering when the player has landed from a jump/fall onto tile, but I found an odd bug I can't seem to work around.  If there is a wall (tile) to the right or left of the player when they land the landing behavior doesn't trigger.  Is there a way to stop walls from interfering with my landing behavior?

merrak

  • *
  • Posts: 2696
I suspect what is happening is that a collision event is triggered on the left/right first, and that prevents a second collision event with the top/bottom from being detected. In other words, the same collision event can't happen twice at the same time, and so the left/right one is the one that is detected. You can verify this by printing something to the log viewer if a collision on the left/right is detected.

My approach to detecting landing is shown below, and hasn't yet been susceptible to this problem. If you're familiar with the 'on ground' behavior shipped with the jump and run kit, the 'on ground' and 'on ground temp' booleans serve the same role. If you've never seen that behavior before, this is the logic:

Code: [Select]
On updated:
    Set 'on ground' to 'on ground temp'
    Set 'on ground temp' to false

On collision with tile
    If bottom of self or top of tile was hit
        Set 'on ground temp' to true

My approach triggers landing on the one frame where 'on ground temp' is true and 'on ground' is still false.

I'm not sure why my approach is working and yours isn't, though. I don't think the logic is all that different--we're both using direction based collision detection. I verified my landing does trigger when brushing up against a wall, so it may be worth trying.

ozz

  • *
  • Posts: 557
I re-downloaded he Jump and Run Kit to see what it was doing  differently.  I did try to incorporate it, but it lacked specificity.   In my game the player's feet are ether Ground Sensor or Stomp Sensor (just type names, not actual sensors) and they can collide with many other types to different effects. Platforms, bounce pads, enemies, etc.   So the blanket if bottom of actor hit = landed isn't really going to work. 

Is there another why to do this while keeping my other interactions working?

merrak

  • *
  • Posts: 2696
It could be a physics issue. Are the feet collision bounds circles?

ozz

  • *
  • Posts: 557
Not circles no, I use just one box for this actor, a square, the one used for landing.  This one is suppose to be the simplified version for non-combat areas (though all actors have this bug).

Edit: For the Tile floor/wall i am just using tilesets.

« Last Edit: May 16, 2021, 09:33:08 pm by ozz »

ozz

  • *
  • Posts: 557
I've been experimenting all morning and I seem to have found a fix, though I have no idea why it worked and the original code did not.  They're virtually identical.   Anyone know why this one worked?