Knockback Issue

0 favourites
  • 4 posts
  • Hello,

    I apologize in advance because I feel the solution for this problem is fairly simple, but I can't quite figure it out. I've combed the forums and have found similar questions to what I'm asking, but nothing has fixed the specific issue I'm having.

    The Problem

    The game I'm making is an autorunner. Instead of using the Scroll To behavior on the player, I have a sprite called spr_ScrollToBlock that is set to stay ahead of the player by an X value of 500.

    The issue is difficult to describe, but easy to understand when you see it. If the player collides with an obstacle before the screen starts to scroll, the knock back effect is applied correctly, as seen in the picture below:

    <iframe src="https://giphy.com/embed/O0L0onyK0A8fHfjPGU" width="480" height="270" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/O0L0onyK0A8fHfjPGU">via GIPHY</a></p>

    As soon as scrolling begins, however, the knock back effect no longer works when the player collides with an obstacle:

    <iframe src="https://giphy.com/embed/g7SInooUIP4VwzkDc2" width="480" height="270" frameBorder="0" class="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/g7SInooUIP4VwzkDc2">via GIPHY</a></p>

    Attempts to resolve:

    As previously stated, I feel like this is an easy to solve issue, I'm just missing something simple. I've tried to resolve the issue by doing the following:

    If you have any suggestions, please let me know. I greatly appreciate it.

  • Whoops, used embed link on the gifs instead of URL:

    Correct Knockback: gph.is/g/Zk8OK2A

    Incorrect Knockback: gph.is/g/ZYP6Bjn

  • It's because you have set vector x and y to self.x - 800. Which means the further along the sprite is, the less of an effect the vector action has. Try changing the action to just an integer:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow...I feel dumb. It is so obvious, but I completely missed it. Thank you so much for your help, I sincerely appreciate it

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