0 Favourites

Create Pushable & Climbable Crates in Platformer

  • Hello, I'm currently working on a platformer game, and I'm having problems trying to get some Physics to work properly.

    I have a character with the Platform Behavior, and a crate with Physics material. What happens is that the pushing crate get really buggy (sometimes, I pass right through the blocks), and when I jump on the crate, my character goes through them (or when a solid is underneath, the crate goes in the middle of the solid, and bounces back up again when I get off).

    Does anyone have good suggestions for implementing this?

    Thank you.

  • dont use physics for the crate pushing, give the crate 8way directional behavior or platform behavior and create the effects you want.

  • I tried that and I just end up passing right through all the crates...

  • Did you set the crates and the controllable sprite to "solid" in the behaviors?

  • Did you set the crates and the controllable sprite to "solid" in the behaviors?

    Yes I have tried turning them to solid, but they become unpushable.

    I want a pushable and climbable crate.

  • For pushable can't you say if platform next to wall and object is (your block) then when you push the button move 10 pixels or something like that?

  • HAXX0RZ This works for me where blue is the player and Sprite 2 is a block with solid behavior:

    <img src="https://dl.dropbox.com/u/10285716/SamplePushBlock.png" border="0" />

    I added a P key is down condition just because I wanted to differentiate between pushing the block and running into it randomly. You can remove that...

  • HAXX0RZ This works for me where blue is the player and Sprite 2 is a block with solid behavior:

    <img src="https://dl.dropbox.com/u/10285716/SamplePushBlock.png" border="0" />

    I added a P key is down condition just because I wanted to differentiate between pushing the block and running into it randomly. You can remove that...

    I just tried that, but it results in some crazy bugs when the solid is pushed towards a solid wall. It also gets buggy when you stack up all those crates.

    Not really the best solution, but can anyone suggest a better way?

  • can you use if set in X/Y coor in condition to set in stone or remove the pushable action?

  • You can set conditions on the blocks for movable or not with a variable, then if they are against another block, don't allow them to be moved.

  • I can try that, though I'm just concerned that the box noticably skips 10 pixels (teleports) every time I bump it.

    Btw, another concern I have on that code is that when you step on top of the box, the box moves on its own. I don't really want to use a bruteforce y-position checker, so is there a better way to do it?

  • I'd go back to where you started from with the physics and work out why it's being weird. It could be something simple like you have uneven sprite masks on your player animation frames.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • HAXX0RZ You can use the next to wall (left or right) condition to avoid needing Y checks. You can also change the number of pixels from 10 to a smaller number, or set the X to be an offset of the players X so it moves as smoothly as the player.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
1,068 148,674
Reflextions's avatar
Reflextions
Unread hot topic
604 153,298
aniketraorane's avatar
aniketraorane
Unread hot topic
256 37,723
tutbarao's avatar
tutbarao