[Help] Crate problems

56 views
Skip to first unread message

ncr...@gmail.com

unread,
Jan 9, 2016, 3:30:06 PM1/9/16
to PuzzleScript
Hi,
In a game I'm making, there is a crate that can only be moved by moving to the side of it. Seems simple enough to code...
http://i.imgur.com/SkcHNPM.gif
...until protruding walls are involved.
http://i.imgur.com/yIoLIsB.gif
I'm not exactly sure how to fix this, since I'm new to Puzzlescript. Here's the code for it:

[^ Player | StepCrate] -> [^ Player | ^ StepCrate]
[v Player | StepCrate] -> [v Player | v StepCrate]

If anyone could try to lend a hand, thanks!

ncr...@gmail.com

unread,
Jan 9, 2016, 3:31:31 PM1/9/16
to PuzzleScript, ncr...@gmail.com
(All I know is that it involves the game interpreting pressing an arrow key being the same as actually moving somewhere)

Chris Pickel

unread,
Jan 9, 2016, 3:51:00 PM1/9/16
to ncr...@gmail.com, PuzzleScript
There are (at least) two solutions to your problem.

The simple one is adding this to the prelude at the top:
require_player_movement

With that setting, if the player doesn't move, nothing does.

The more complicated one is adding a rule before the pushing rule to cancel out the player's movement:
[> Player | Wall] -> [Player | Wall]

See, rules are run in two phases. First, all the regular (non-late) rules are run before movement is resolved. Then all late rules are run after movement. The pushing rule is run in the first phase, before movement happens, so at that point the player's movement hasn't been blocked.

By the way, there's a shorthand "perpendicular" which means "^ or v":
[perpendicular Player | StepCrate] -> [perpendicular Player | perpendicular StepCrate]

On Sat, Jan 9, 2016 at 3:31 PM <ncr...@gmail.com> wrote:
(All I know is that it involves the game interpreting pressing an arrow key being the same as actually moving somewhere)

--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ncr...@gmail.com

unread,
Jan 11, 2016, 9:33:14 AM1/11/16
to PuzzleScript, ncr...@gmail.com
Thank you!
Reply all
Reply to author
Forward
0 new messages