How to make pushable sprites using blocks?

I’m completely stuck ;-;

I’m trying to figure out how to make my sprite “push” another sprite (such as a box or boulder) while walking into it.

set (mysprite) friction to -() from the sprites category, I think. It might be the other way around, so set (mysprite) friction to ()

Here’s an example of pushing a block with tilemaps:

I was having fun with this concept, so here is another much, much, much more complicated example that lets you push multiple blocks at a time:

4 Likes

Is there a way to make this for a top-down game without gravity and being able to push it left right up and down?

@toxic_lj sure! something like this?

There are comments in that project that explain the code

3 Likes

Yes! Thank you so much

yea thats a way better way then what i did Also i noticed that you cant push more then 1 Box at a time ive been trying to get that to work in my game for a while mind if you help me?

2 Likes

pushing more than one block at a time is only slightly more complicated. basically, you want to scan for pushable tiles in the direction the push is happening and see if the line of pushable tiles ends in an empty spot or not.

here is that same sample code updated so that you can push more than one block

3 Likes

sonic blaston made an extension for this

2 Likes

I’ve recently come back to Makecode, thank you so much for your help! Looking forward to working on this again.

1 Like