How do I Stop my player hanging about in thin air - Platform

0 favourites
  • 6 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi,

    I have been working on a platformer game for a while and come back to an issue, which has been annoying me for a while.

    I have 2 players each with around 8 animation objects with their own animations or about 9 frames each.

    I have a couple of issues.

    1. Sometimes when I am jumping through an object such as a tree branch, the player does not always get to the top of the collision points set on the branch and then appears to be hanging halfway. I jump again and then he is on top as expected.

    2. When I am walking off an object, the player can sometimes appear to be just hanging in thin air or sort of slide down to the middle or bottom of the object he is standing on.

    I thought it may have something to do with my collision polygons, but I have checked them all on each animation and frame and they are "close" to being the same. They have to differ to some degree as a run animation is wider than an idle animation etc.

    I have seen somewhere on a different gaming platform the use of a feet object and was wondering if this is what I should be looking at instead, meaning that perhaps I should be creating a container with a player object, pin feet to the bottom of it, then pinning my character ontop?

    Do I need to do this or is there something I am missing with just a player object and the character pinned to the top?

    Below is the collision polygons and what the character is doing. The players box which the character is pinned to has the same polygon collision points set as the character. The bottom 2 images show that the playerbox is hanging in thin air and then that the player seems to be in the object also. I have tried messing with the collision points to no end and seem to keep getting a similar result. I have also made the collision polygon on the object that he is standing on a single line, thinking it may be 2 wide, but this had little to no change.

    [attachment=0:1q4zrnj2][/attachment:1q4zrnj2]

    Thanks,

    Paul

  • I've experienced the same issues. The problem is the shape of the collision polygon. Even though you have it at an angle, that doesn't mean it will slide off. Those lines are still made of pixels that are square. So when you shape the players collision at an angle, your really creating a series of edges. Make the collision shape square or rectangular but straight 90 degree angles and that includes the platforms too. You can see the edges even in the images you posted and even the slightest difference will cause the player to get hung up.

    Hopes this helps

  • It's generally better, it seems, to have an invisible rectangle for the Platform behavior stuff, and non-platform stuff to be handled with the sprite.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    Thanks for the quick responses. I will try and square everything up tonight and see if that helps. In my mind it would slide off but thinking about it, having an angle would create a problem.

    I do have what you describe also Unnatural20, so I think the recommendation by the TheDom may be the answer.

    Cheers,

    Paul

  • I've been there. As has been said, the proper way to do this is to have a single frame square sprite as the player, make it invisible (or opacity 1) and just pin your animated character to it.

    If you work directly on the animated sprite there will always be the problem with the collision polygon changing between frames, or not being perfectly horizontal etc.

  • Hi Everyone. I have as what pirx and Unnatural20 have stated. The problem was with my collision polygons not being straight on the edges of the players square, which is what I use for the detection. I made all the frames straight and the problem has been fixed. I have left my characters polygons the same as they change depending on what he is doing so it works well together.

    Thank you all!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)