[HELP] Slippery oil?

90 views
Skip to first unread message

family...@gmail.com

unread,
Apr 2, 2016, 3:40:29 PM4/2/16
to PuzzleScript
So i'm making a game about lawn mowing, and I am trying to make it so if the lawnmower runs into oil, it continues sliding until it hits the background or some grass. Basically, i'm trying to make a sliding mechanic. Does anyone know how to do this?

jre...@gmail.com

unread,
Apr 2, 2016, 6:02:22 PM4/2/16
to PuzzleScript
On Saturday, 2 April 2016 13:40:29 UTC-6, Blake Regehr wrote:
> So i'm making a game about lawn mowing, and I am trying to make it so if the lawnmower runs into oil, it continues sliding until it hits the background or some grass. Basically, i'm trying to make a sliding mechanic. Does anyone know how to do this?

I've tried alot of stuff...

Ben Erlebach

unread,
Apr 2, 2016, 8:58:14 PM4/2/16
to PuzzleScript
It's difficult to say what to do without knowing exactly what your setup is and how you want the effect to work.

If the lawnmower and the oil occupy the same physical space, then you could do something like:

[ > Lawnmower Oil | Oil ] -> [ Oil | > Lawnmower Oil ]
[ > Lawnmower Oil | ] -> [ Oil | Lawnmower ]

which will apply itself as many times as possible, and thus cause the lawnmower to slide all the way to past the end of the last oil.

An alternative thought is to use the again keyword. This has the nice side-effect of looking visually appealing, but you would need some way of storing the direction the lawnmower was travelling so it's not lost on the turn change. For example, using a transparent object called LastSpace:

[ LastSpace | Lawnmower ] -> [ LastSpace | > Lawnmower ]
[ LastSpace ] -> [] ( Just in case something weird happens )
[ > Lawnmower | Oil ] -> [ LastSpace > Lawnmower | Oil ] again

These may not be the best approaches, but they're the first things to come to mind. I haven't tested either of them.

Michael Fairley

unread,
Apr 3, 2016, 10:52:04 AM4/3/16
to PuzzleScript
I put together a small demo (a tweak of basic tutorial that you start with) that adds ice blocks that crates will slide over: http://www.puzzlescript.net/editor.html?hack=1433d5fa0ce113b0710ba5dba4b4158c

Hope it helps!

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

David Kempe

unread,
Apr 3, 2016, 1:57:15 PM4/3/16
to PuzzleScript
If a counter-example may help, the "swim" mechanic in my Overrwyrld game functioned similar to ice, where you'd continue in that direction until hitting a different surface. To make it work though I had to concede animating the first square.

http://www.puzzlescript.net/play.html?p=52dd371d0b74fe1789f8

Blake Regehr

unread,
Apr 4, 2016, 4:29:12 PM4/4/16
to PuzzleScript
Beautiful. Works perfectly. Here's the code I wrote.
[ LastSpace | player ] -> [ LastSpace | > player ]
[ LastSpace ] -> []
[ > Player | Oil ] -> [ LastSpace > Player | Oil ] again

My game should have a rough finish in a week.
Reply all
Reply to author
Forward
0 new messages