Help with getting a non-player object to move another

47 views
Skip to first unread message

Alexander Tyson

unread,
Aug 27, 2016, 6:01:29 AM8/27/16
to PuzzleScript
Hi, I'm making a sokoban-style game and I have the player character as well as another character which moves in the opposite direction to the main character.

The player moves blocks fine, but when the "opposite" interacts with the blocks they don't move until the next turn (and you can't seem to use a "late" command on a movement)

[ > RegPlayer ] [ NegaPlayer ] -> [ > RegPlayer ] [ < NegaPlayer ]

[ >  RegPlayer | BlueApple ] -> [  >  RegPlayer | > BlueApple  ] 

[ >  NegaPlayer | BlueApple ] -> [  >  NegaPlayer | > BlueApple  ]  

This is what I have in the rules, does anybody have any suggestions as to what I may be doing wrong?

Many thanks,

Alexander

Alan Hazelden

unread,
Aug 27, 2016, 6:46:41 AM8/27/16
to Alexander Tyson, PuzzleScript
Can you post a link to a working example? That looks like it should work, which means the problem is probably somewhere else in the rules.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alexander Tyson

unread,
Aug 27, 2016, 7:19:52 AM8/27/16
to PuzzleScript, atyso...@gmail.com
http://www.puzzlescript.net/editor.html?hack=d1323f07264dbc86d2d2d8b3d5359717 Here you go. I'm still very new to the world of PuzzleScript so apologies for my code being a total mess!
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.

Alan Hazelden

unread,
Aug 27, 2016, 7:35:57 AM8/27/16
to Alexander Tyson, PuzzleScript
Your problem is that you need to have the [ > RegPlayer ] [ NegaPlayer ] -> [ > RegPlayer ] [ < NegaPlayer ] rule before the other rules - rules are executed in order, so when the NegaPlayer pushing apples rule gets checked, the NegaPlayer hasn't yet been told to be walking towards the apple, so the rule doesn't apply.

To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript+unsubscribe@googlegroups.com.

Alexander Tyson

unread,
Aug 27, 2016, 9:22:02 AM8/27/16
to PuzzleScript, atyso...@gmail.com
Ah wonderful, thank you!

Just noticed another problem that I'm stuggling to find a solution to. When the Regular Player moves into a wall, the "opposite" still moves in the other direction despite the regular one not moving. Is there any way to fix this?

Hand-E-Food

unread,
Aug 29, 2016, 4:04:43 AM8/29/16
to PuzzleScript, atyso...@gmail.com
Add the require_player_movement keyword at the start of the file, in the same region where you have the title.  This will cause the turn to cancel if the player finishes where it started.

Alexander Tyson

unread,
Aug 29, 2016, 6:11:02 AM8/29/16
to PuzzleScript, atyso...@gmail.com
That's sorted it, thank you!
Reply all
Reply to author
Forward
0 new messages