Pushing boxes in top down view.

0 favourites
  • 3 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template for top-down view games)
  • I have two issues with pushing boxes in my top down game.

    I've imported a picture of a crate, given it 8-direction movement and enabled custom movement so it doesn't move when the player does.

    I have made the character "Solid" 8-direction movement. He can now push the box around but only on diagonals it seems. This is of course relative to whatever the base angle might be I'm assuming, but why would the default be at a 45 degree interval?

    I have tried limiting the movement of the crate to up and down, left and right, 4 directions, 8 directions and at every angle interval the pull down menu will allow (including none) and the behavior never changes.

    The bounding box of the player character is also a square. The only way i could make sense of it was to put each box at 45 degree angles so at least the pushing was consistent with the face you pressed on.

    I don't need the box to snap to a grid space or move at defined periods, I just want the box to move logically. I do want the box to be restricted to 4 way movement and not to rotate, but it seems to be doing that already, albeit at an angle I wasn't expecting.

    Secondly, there doesn't seem to be a way of creating inertia for these moved boxes, they simply stop moving upon collision. I'd love if there was a "physics" solution to this, but the current physics behavior seems to be only designed for sidescrollers.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wouldn't give the crate 8-direction behavior at all!

    Here is one idea:

    Surround the player with 4 (or 8, in the shape of an octagon for diagonals) invisible collision detectors. They should be very thin and 'border' the player.

    Then, you can simply check the crate for overlapping the individual detectors, and tell it to move away from it on overlapping.

    This should get you the required result.

  • okay, removing the 8 way directional from the crate and moving it on overlap at player.8direction.Speed/32 pixels at angle player.angle gets it to move at the right speed. Three questions arise.

    Is there a way to restrict the crate to only move along the axis I want (top, bottom overlap = y axis movement. left, right overlap = x axis movement)

    How do I set up the math and behaviors to allow the crate to run into other crates and carry it along somewhat believably? using the pin behavior they act like sticky crates and catch each other at any angle and begin.

    Inversely, how would I create it so a moving block can not push another moveable block but instead is blocked by it?

    I guess i really need a top down physics system to get what I want out of this feature. Thanks to any who try to wrap their brains around it. I will be, too.

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