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

Get help using Construct 2

Post » Wed Jan 28, 2015 2:44 am

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.

c2_collision_issue.png


Thanks,

Paul
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 38
Reputation: 417

Post » Wed Jan 28, 2015 3:01 am

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
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Wed Jan 28, 2015 3:14 am

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.
B
11
S
4
Posts: 152
Reputation: 1,236

Post » Wed Jan 28, 2015 5:05 am

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
B
6
S
1
Posts: 38
Reputation: 417

Post » Wed Jan 28, 2015 9:45 am

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.
B
16
S
7
G
1
Posts: 158
Reputation: 3,125

Post » Wed Jan 28, 2015 11:04 am

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!!
B
6
S
1
Posts: 38
Reputation: 417


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests