So i have a crate my character can push (15x15) that also is in different sizes via scaling. I want to make it so my character push/pull a box horizontally with a button prompt.
So far i’ve come up with this
Idea here is that if either side of the character collides with the object and “E” key is pressed :
-
It will just mimic the characters movement
-
Animation checks ensure that the character is on the ground.
-
Top/bottom bounding box check ensures character won’t clip through the box
-
Move away command is to ensure character doesn’t get pushed into the box
-
Move closer command is there because you can’t really pull without pushing so it just pulls the crate to the character sprite by 1 pixel so you can just pull.
Works well but ONLY for a singular box. If i have multiple movable boxes on top of each other pressing “E” just makes them overlap.
I have also tried the Pushable/Pullable Box extension but it doesn’t work very well. My character just overlaps with the Box and for some reason you can only push and pull from one side of the object.
Tried looking up for tutorials on the internet aswell but no luck. Most of the tutorials are for just carrying an object with stick command which changes the objects location + i’m guessing it will be hard with objects with different sizes.
It’s kind of embarrasing that i’ve spent this much time on a simple function but i can’t seem to find my way around it : D Any help is appreciated