[DONE in 5.0.139] Idea: Pushable Block behaviour

What if there was a pushable block behavior? A top down version, and a side scroller version. The player simply pushes the block. For the side scroller version, you could set it so if it has gravity or not.

Like those Sokoban games.

1 Like

Could be nice to have it in an easy way. It is doable right now with a couple of events.

what are those events?

A little set like this can do the trick:

It was kinda fast, yet I added a little “weight” effect on the box. When the character collides with the box, the speed is halved. Again, no needed, but I think it looks good.

If you want it to have “gravity”, you can make the box a platform character, ignoring the default controls, that way it will get the gravity pull automatically, as well as the proper platform collisions.

In this case, since I want the “box” to work as a base as well, I set a condition. If the player is above the “box”, the box pushes the player away. The player is not colliding with the box so I add a condition so it can jump.

If the box is in line, or above the player, the box is pushed when they both collide.

The problem with the above approach is, the player will have a falling animation all the time it is over the box, unless you manually change it to the idle or walking animation when needed. So another way to make it, better, is to have a thin platform object just above the box, this way:

As you can see, there is a thin black line over the box. It is the base you can use to step over, no falling animation. The base may be set to no visible so it may be not noticed at all.

These are the tricks I can think right now. I hope it helps.

2 Likes

Yep, there are quite a few quick/easy ways to do pushable movement (for anything, not just boxes), usually only requiring a few conditions and actions to accomplish. oscuridad666’s methods are some of them. There’s also a good tutorial from Wishforge on youtube that has another.

Because it’s simple enough to implement via events, I’m not sure an official behavior would be made for it. (I’m not making a judgment whether it will or not, just based off prior “official behavior request” responses I’ve seen in the past.)

It may have enough variance for a user extension though, if you (or anyone) wanted to made one.

Okay, I made, but when you push it against a wall, the player will go through it halfway, than it will warp behind him. Like a rubber balloon.

You can always check if the box is colliding against a wall, if it happens, then the character must be separated from the box.

I have a green wall on the right side, and as you can see, I can’t move the box any further, nor the box or character go inside each other, just as intended.

My game is top down. I did what you said, but now when the box touches a wall, I can’t push it from any angle.

So I can’t push it sideways when it’s against a wall.

Do you move the box away from the wall if the two collide?

yes please. I want to have it so you can still move it side ways when it’s against a wall.

Crazy idea, yet it worked fine, I think:

When you push the box against a wall, the box is pushes away and the character is pushed away. As soon as you move a bit, the box shrinks very subtle before getting its regular size.

With this, you can push the box away again.

Not the ordinary way to make it happen, yet it works.

In addition to what @oscuridad666 is suggesting,

moxingCrates

These are the events :

What do your events look like?

2 Likes

I tried doing what you did, But it’s not working. This is what I currently got.

Do you have any behaviours attached to pushables?

no. I don’t. It’s just a sprite.

What other events involving the pushables, walls or Lyrod are there?

so far this is it.

I changed it to this:

But now I got the rubber balloon situation again.

I updated it to this and now it works!

1 Like

Why do you have a repeat? What happens if you do just as I did?

Because why do you need to iterate through all the pushables, when you’re only interested in the one that’s in collision with Lyrod?