How to make things slide like on ice?

605 views
Skip to first unread message

Hoboken Pudding

unread,
Jun 10, 2016, 5:22:21 PM6/10/16
to PuzzleScript
I'm trying to understand how to make the Player move across and not stop until they hit a wall. I'm doing a new version of this marble maze but I want the player to roll down the corridor, not move step-by-step. https://hobokenpudding.itch.io/lil-red-marble

I've takena look at the code for a few ice games but am not clear what is being set up. Do you need to create four instances of the player "PlayerU, PlayerD, PlayerR, PlayerL"? I assume "again" is used but not sure how. Any help or point to examples would be appreciated.


Stephen Lavelle

unread,
Jun 10, 2016, 8:34:16 PM6/10/16
to Hoboken Pudding, PuzzleScript
maybe something like

[target wall]->[]
[ player ice | target | ] -> [ >player ice | | target ] again
[ > player ice | | ] -> [ > player ice | | target ] again


On Fri, Jun 10, 2016 at 10:22 PM, Hoboken Pudding <hoboken...@gmail.com> wrote:
I'm trying to understand how to make the Player move across and not stop until they hit a wall. I'm doing a new version of this marble maze but I want the player to roll down the corridor, not move step-by-step. https://hobokenpudding.itch.io/lil-red-marble

I've takena look at the code for a few ice games but am not clear what is being set up. Do you need to create four instances of the player "PlayerU, PlayerD, PlayerR, PlayerL"? I assume "again" is used but not sure how. Any help or point to examples would be appreciated.


--
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.

Message has been deleted

bouch...@gmail.com

unread,
Jun 15, 2016, 3:29:23 PM6/15/16
to PuzzleScript, hoboken...@gmail.com
Thanks. This helped, but got weird.

Hoboken Pudding

unread,
Jun 15, 2016, 3:30:42 PM6/15/16
to PuzzleScript
I've been able to get the player to move across to the first instance of a wall or crate, but it's a jump, not a slide.
See here: http://www.puzzlescript.net/play.html?p=d9391c4340e6753ee166c37abf376acc

I'm using the following:

[ > player | no Item ] -> [ | > player ] again
[ > player | Wall ] -> [ player | Wall ]

I'm not sure how to get it to slide across, space by space, rather than jump.

Hand-E-Food

unread,
Jun 15, 2016, 9:24:30 PM6/15/16
to PuzzleScript
You need an object that will keep track of which way the marble is travelling.  Let's call it Cursor.

========
OBJECTS
========
...
Cursor
Transparent

It should be in its own layer.  I use the top layer so I can easily give it a sprite to watch it when debugging.

================
COLLISIONLAYERS
================
...
Cursor

And you want to place this Cursor a couple of squares in front of your moving Player so it can chase it.  These three rules:
  1. If the Player is next to a Cursor, move the player towards the Cursor and remove the Cursor.
  2. If the Player is moving, caused by control or by rule 1, place a Cursor a couple of squares ahead and trigger another turn.
  3. If the Cursor is on an Item, remove the Cursor so the Player stops chasing it after this turn.

======
RULES
======
...
[ Player | Cursor ] -> [ > Player | ]
[ > Player | no Item | ] -> [ > Player | | Cursor ] again
[ Cursor Item ] -> [ Item ]

Also, I think you don't want your Target to be an Item.  It's part of the floor, not an obstruction for the player.

Hand-E-Food

unread,
Jun 15, 2016, 9:52:18 PM6/15/16
to PuzzleScript
On another note, I like your game!  I look forward to seeing more puzzles.

I had a thought for a couple of features when you feel more confident.  Currently you can only push a crate if your adjacent to it.  How about a heavy crate that you can only push with a run up, and a light crate that you can push adjacently or with a run up (whether you like it or not.)

Hoboken Pudding

unread,
Jun 16, 2016, 9:51:02 AM6/16/16
to PuzzleScript

I had a thought for a couple of features when you feel more confident.  Currently you can only push a crate if your adjacent to it.  How about a heavy crate that you can only push with a run up, and a light crate that you can push adjacently or with a run up (whether you like it or not.)

Thanks for all the feedback. I had thought of making the crates that would move with a run up but I also like your ideas for different weights. I'll see what I can do!

Hoboken Pudding

unread,
Jun 16, 2016, 3:35:13 PM6/16/16
to PuzzleScript
This works great and does exactly what I was looking to do. I'll post an update once I get some more puzzles in there.

frankmc...@gmail.com

unread,
Nov 23, 2018, 2:14:17 PM11/23/18
to PuzzleScript
How would you make a crate, that when pushed, it would slide until it hit a wall?

That Scar

unread,
Nov 23, 2018, 5:17:40 PM11/23/18
to PuzzleScript
Here are some things I quickly came up with but didn't test so do come back here if they don't work and you can't figure out how to make them work:
If you don't care about crates "teleporting instead of moving", here is a quick hack:

[ > Crate | Ice No Crate No Wall ] -> [ | > Crate Ice ]

If you do care about that teleport bit or if you don't want the "if there's no crate in front of me" clause because you want crates to push other things, I suggest creating 4 invisible objects that just say "continue left", "continue up" and so forth.

Up [ ContinueUp | Crate Ice ] -> [ | > Crate Ice ]
Left [ ContinueLeft | Crate Ice ] -> [ | > Crate Ice ]
Right [ ContinueRight | Crate Ice ] -> [ | > Crate Ice ]
Down [ ContinueDown | Crate Ice ] -> [ | > Crate Ice ]

[ ContinueUp ] -> [ ]
ContinueLeft ] -> [ ]
ContinueRight ] -> [ ]
ContinueDown ] -> [ ]

I think you should do the other code inside here and after you're done, finish with these lines:

[ up Crate ] -> [ up Crate ContinueUp ] again
[ left Crate ] -> [ left Crate ContinueLeft ] again
[ right Crate ] -> [ right Crate ContinueRight ] again
[ down Crate ] -> [ down Crate ContinueDown ] again

The `again` tag will tell it to continue doing all the code again and again until it all boxes have stopped from moving and a huge plus of this method is that you can actually see the boxes moving in action instead of zooming straight to the end of the ice line, yay! (again, I didn't test this code)
Reply all
Reply to author
Forward
0 new messages