Return to original place after "Bounced"

seveksevek Member, PRO Posts: 30

Hi~ @gyroscope‌ and @RThurman‌ ! =)

So, I am almost done with my first game and would like to ask one more question.

I have this character which moves up and down at a constant X-coordination (Thus, the character is only moving up and down).

When this character collides with an object that flies at him, i made it so that these two actors bounce off each other.

I realized that they bounce off infinitely and off the screen.

Is there a way to return the main character back to its original x-coordiation even after the bounce?

Thanks! =)

Comments

  • Nabbo (ReflectiveByte)Nabbo (ReflectiveByte) Member Posts: 278

    Try to reduce bounciness valve on both the charactors and object (.5 or .2).

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @sevek How about amending an aspect of your game and not have the actor that moves up and down react to the collision?

    To explain further, just have the When your other actor collides with it, have it Collide behaviour make it bounce off, but the one moving up and down keeps travelling on its merry way...

    A thought - but if you don't like that idea I'll think again...

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2014

    For the bouncing actor increase drag so that when the object that flies at him knocks him out of his X position he comes to a rest before leaving the screen.

    Then in the bouncing actor have a rule that says when linear velocity is less than 1 (or whatever value you want) interpolate the bouncing actor back to its orginal X position (use easy ease in).

  • seveksevek Member, PRO Posts: 30
    edited July 2014

    @nabbo‌ @gyroscope‌ @Socks‌ ! =)
    Thank you for the wonderful comments!
    I will try these methods and see what I come up with!

    Thanks and have a wonderful Sunday!

    ps. I know it is a small feature, but I think it adds to the user experience when they see things bounce off as they would expect in real life :smiley:

  • seveksevek Member, PRO Posts: 30

    Thanks guys!

    I got it working! =)

    (ps. for those, who wants the same function, refer to the screenshot)

    Thanks

Sign In or Register to comment.