is it possible to make Player collide with actor only if its over it but can jump through it?

kareemahmed28@yahoo.comkareemahmed28@yahoo.com Member Posts: 3
edited June 2014 in Working with GS (PC)

Hello everyone and thanks a lot for taking the time to read.
I wanted to make a player collide with a platform but only if the player is over the platform and got it to work by doing this:
If player position Y is more than Platform position Y then collide with platform.

But unfortunately, it only works if there is one platform because if there is another one, it will count the Y position of the first one and will collide with the actor from beneath, making me unable to jump through it.

Here are some images

http://postimg.org/image/79nzul9wf/

http://postimg.org/image/68gu2zlkd/

http://postimg.org/image/9ep8tnzfx/

http://postimg.org/image/bxaxucl65/

As you can see in the last image it collides with the platform on top before jumping through it and colliding with it from over like in the first one.

The only solution i can see is making an attribute for every single platform, but what if i want to make hundreds? is the device going to handle?

Thanks a lot for any replies and thanks for talking the time to read.

Comments

  • ArmellineArmelline Member, PRO Posts: 5,351
    edited June 2014

    Here's a small example, assuming I understood what you meant.

    What you need to do is this:

    Constrain the player's Y position to a game attribute.

    Within the platform actor, compare the platform's position + half it's height to the player's position - half it's height. If the player is higher than the platform, collide with the player.

    That way you're seeing if the bottom of the player is higher than the top of the platform.

    (The attached project was made on a Mac but should be able to be opened in Windows Creator no problem.)

  • Thank you so much!! I got it to work. I can't believe you took the time to make a template for me, thanks a lot!! Really appreciate it.

Sign In or Register to comment.