Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Block Pushing Iterated
- b2ey
-
92 posts
Block Pushing Iterated
I spent quite a while searching for box-pushing scripts and Sokoban clones. What I wanted was a box-pushing script that would work with several boxes in a row. I couldn't find anything
@Sad_Bread_Official's Baba IS You Engine Illustrates the behavior I'm aiming for. Several pushable objects can be moved in a row. It seems just fine, but Sad Bread wasn't able to make this push chaining function properly against walls. If a rock (or something else, because this is “Baba IS You”) pushes up against a wall, it will jus glide over.
I tried to make something myself, but I got lost in the middle.
Is there a simple way to get boxes to push boxes?
- creepycreep555
-
100+ posts
Block Pushing Iterated
Yeah, you should probably add something like a move if touching and movement key pressed.
when green flag clicked
forever
if <<key [Key you want for movement v] pressed?> and <touching [Box(es) v] ?>> then
move (...) steps
end
end
Last edited by creepycreep555 (Dec. 15, 2020 00:55:44)
- creepycreep555
-
100+ posts
Block Pushing Iterated
Also, if you want it to go into different directions, use this.
when green flag clicked
set rotation style [Dont Rotate... Or something like that v]
when green flag clicked
forever
if <Key movement thing and touching boxes.> then
point in direction (... v)
move (...) steps
end
end
- b2ey
-
92 posts
Block Pushing Iterated
@creepycreep555 I think you missed what I wanted. I'm not sure how to clear it up, but you definitely misunderstood. Or maybe the code is wrong.
- creepycreep555
-
100+ posts
Block Pushing Iterated
Yeah, uh… i saw the block getting moved, but its a lot of animations and gliding to a certain x and y axis. its alot i dont understand. sorry. @creepycreep555 I think you missed what I wanted. I'm not sure how to clear it up, but you definitely misunderstood. Or maybe the code is wrong.
- b2ey
-
92 posts
Block Pushing Iterated
Yeah, uh… i saw the block getting moved, but its a lot of animations and gliding to a certain x and y axis. its alot i dont understand. sorry. @creepycreep555 I think you missed what I wanted. I'm not sure how to clear it up, but you definitely misunderstood. Or maybe the code is wrong.
It's a mess, I know. But I think I know what you meant now.
Also, whatever the code is, it doesn't work with respect to walls. It just hops over them.
- Discussion Forums
- » Help with Scripts
-
» Block Pushing Iterated