How do I prevent this collision issue?

0 favourites
  • 10 posts
  • Hi all,

    I am using 8 directional movement and solid objects for collision.

    I am finding that when my sprite collides with these objects they do stop, but once the arrow key is released the whole screen jumps suddenly. It's very distracting and doesn't make for a smooth game experience.

    This seems to be happening with every solid object that the player can run into.

    I've made this video to show what I am talking about: drive.google.com/file/d/1Itm8vliCIGywbGh-Z-GIEL9FQRvcJXuB/view

    Is anyone else experiencing this glitch? Is this even a glitch?

    I am not sure why this is happening...

  • Is your player also a solid and are you moving directly left in your example? Are you using multiple collision boxes for the wall or a single straight one?

    Post your project file so we can have a look

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also check the 'Origin' point of your 'Animation' and 'Default' (standing) are exactly the same, or centered. Click on Origin and 'Apply to All Animations'.

  • El Constructorr

    Thank you! It turns out it was the origin point that was causing the issue.

    Are there any best practices for origin point? I'm trying to keep it bottom left for all my animations but I'm not sure if that is what I should be doing.

  • Nevermind... El Constructorr calminthenight

    That worked for the walk-left collisions but the walk-up collisions are still doing the same thing. Here is a link to download my game file: drive.google.com/file/d/1-oHLu9Qa7chBSLDShJnLy67L_3A4KOkg/view

    Thanks!

  • the.sand The share link is restricted. You need to choose "Anyone with the link can access" before sharing. Thanks.

    To answer your question about best practices, well yes, there are. Like for your case, since you have multiple animations (and each animation could be different in size) so the best practice would be to select the Origin at (let's say) on the Head of the player and select 'For whole animation', and do that for each Animations.

    Note: For that above, you have to select "For whole animation" and not the same "For all animations". That way, each change in animation would have the player's "Head" aligned (since that's a common/stable part of the character, unless you decide to behead him).

  • My apologies El Constructorr I thought I had set the link to public.

    It's now set correctly.

    As for origin point I have been using the characters back foot as the common point throughout all the animations so it sounds like I'm on the right track.

    Really appreciate the help!

  • Hi the.sand

    So I looked into it.. I saw many things together that was affecting the glitch.

    1. The acceleration 1000 (due to which it was forcing itself forward). I know it is required, so I have a solution.
    2. The Aimer Collision Polygon was too small. Make it full sized
    3. The Aimer should not be destroying and recreating every tick! (That also affects the performance, apart from the glitches).

    All three changes are highlighted below:

    Note:

    1) I did not send you my updated c3p because I was experimenting, and may have changed other things I don't even remember. So just make those changes and hopefully it should work (let me know).

    2) I still insist on making the Origin of Walking at least to Bottom-center, not left most. It should be symmetrical. Otherwise you may end up facing more problems later.

  • El Constructorr

    I cannot even begin to express how grateful I am.

    Taking the time to look at my file and provide such a detailed and helpful response is truly selfless. Thank you so so much!

    This solved my problems AND increased performance!

    I thought I had to create and destroy the aimer...not sure why...

    Also regarding the origin point, I think you're right. I will have to update all my animations but it will be worth it in the long run.

    Again, I cannot thank you enough. Your generosity is remarkable.

    Hope you're having a wonderful day!

  • Thank you so much the.sand for the appreciation and the kind words! :)

    I just love to help :P and I'm glad I could!

    Good luck with your game! Looks very promising!

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