Platformer pushing a block

  • Good day!

    I'm working on recreating the classic "Elevator Action" arcade game but with a few of my own twists as a "proof of concept" project for a larger game I'm working on.

    One thing I'm trying to do is to make it so a box ("Box" object) is "pushed" along depending on which side the Spy ("Spy" object...I'm sensing a trend here) is moving against it.

    For the most part, the action works, albeit, a bit jerky. The main problem is that on occasion there seems to be an overlap of the Spy and Box objects and the process comes to a halt (however, I can move away from the Box and things continue as normal).

    I want to accomplish two things:

    1. the Box appears to move as close to Spy as possible without the "bouncy" effect of the Box moving forward then stopping.

    2. prevent the overlap which causes both the Box and Spy from soft-locking in their movements.

    Both Spy and Box have the Platform behavior and the Box also has the Solid behavior

    Box has an additional object Pinned to it to detect when Spy is close enough to "push" the Box.

    I set the movement speed for both the Box and Spy either equal or the Box is 1 pps faster.

    This is a screenshot of my current event sheet:

    Tagged:

  • dop2000 - I. Am. Amazed.

    That pretty much solves my issue. THANK YOU!

    I'm only mad because for all my time using Construct, things like this - so simple! - evade me. I'm extremely grateful for your help. God bless you!

  • dop2000 - Once again, thank you! Your work helped me out greatly.

    I took what you offered me and set it up just a tad different but the end results are virtually identical.

    The only issue I'm still having is that there is a very minimal "bounce" between the Box being pushed and when the Spy catches up to continue pushing it. For the sake of my proof of concept, I'm not worried about this, but eventually, I'd like to clean up that little nuance as I want to produce the smoothest looking effect as possible. Any insight you have would be greatly appreciated.

  • My first thought is maybe making the hitboxes smaller on each/either?

  • FromChris - It would still create the same issue...just with smaller hitboxes. The space between the character and the box would visually be smaller, however, so that would solve that matter. But it would still arguably create a slightly bouncy effect of the box being pushed ahead and then the character playing catch up a split-second later. Presently, however, the matter is about 99% resolved for my present needs.

  • Thank you, I look forward to reviewing that after work today.

  • Thank you, I look forward to reviewing that after work today.

    Updated capx by adding variable to control the Pushing speed of the block.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sizcoz Your demo is interesting, but there are a few problems with it - Both player and box need to be on the floor at the same level, for example you can't push the box up or down the slope.

    And also, because the box is moved by changing its X coordinate and not with Platform actions, it can be pushed into walls and other obstacles.

  • sizcoz Your demo is interesting, but there are a few problems with it - Both player and box need to be on the floor at the same level, for example you can't push the box up or down the slope.

    And also, because the box is moved by changing its X coordinate and not with Platform actions, it can be pushed into walls and other obstacles.

    Yes, these things are true, I would imagine, using physics would be a better realistic alternative anyway.

    cheers

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