Get the box moving.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mohan
:warning: Old Version Published before Godot 3 was released.

Here I am. Once again. Asking a kind of different question.

I have no idea how to make this freaking box move. In my scene. I am trying to make this sokoban game work, but if I can’t make this box move, then I am not going to make it.

I tried making the box node a RigidBody2D and setting the default gravity to (0,0) in the physics properties. That should avoid making it fall to the ground. But I can’t make the player push it. It will just block the way of the player like a regular static body.

Please help.

Screenshot of the level:
Here is a screenshot of the level scene:

:bust_in_silhouette: Reply From: kidscancode

To push the block your player would have to be a RigidBody too (I’m guessing you’re using KinematicBody?). And then depending on the relative masses and applied force, the block would move.

But that’s typically not how Sokoban-style games work. They’re definitely not using physics - it’s way too complex. You just use a grid, and if the player moves into a block, you try and move the block by one square.

I recommend you check out GDQuest’s tutorials on Grid-based Movement: https://www.youtube.com/watch?v=BWBD3i00AfM

Yeah, I was thinking that this wasn’t the way it was done, but I thought that I could give it a shot. I’ll check out that tutorial series!

Thank you very much :slight_smile:

Mohan | 2017-08-22 13:09