Skip to content

Instantly share code, notes, and snippets.

@ncrecc
Last active April 17, 2021 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncrecc/8edd4e96a28b65e446839fb4aac4969d to your computer and use it in GitHub Desktop.
Save ncrecc/8edd4e96a28b65e446839fb4aac4969d to your computer and use it in GitHub Desktop.
Magnets, How Do They Work? (Pattern:Script Script)
Play this game by pasting the script in https://clementsparrow.github.io/Pattern-Script/src/editor.html
title Magnets, How Do They Work?
author Thinky Collective
homepage www.puzzlescript.net
(log:)
(#0 jcygo: initial version. no wincon.)
(#1 ncrecc: added a wincon, made 2 levels)
(#2 ncrecc: added metal, made 2 levels and some sketches)
(#3 ncrecc: added a sketch)
(#4 ncrecc: patternscript!)
========
========
TAGS
Polarity = PosNegV NegPosV
Charge = Polarity Neutral
MAPPINGS
Polarity => OpposedPolarity
PosNegV NegPosV -> NegPosV PosNegV
OBJECTS
Background
LIGHTGREEN GREEN
11111
01111
11101
11111
10111
Wall
BROWN DARKBROWN
00010
11111
01000
11111
00010
Player
Black Orange White Purple Blue
.000.
.111.
22222
.333.
.3.3.
Magnet:PosNegV
red blue grey
00000
00000
22222
11111
11111
Magnet:NegPosV
blue red grey
00000
00000
22222
11111
11111
Goal
Yellow Gray
00000
01110
01110
01100
01110
Metal
lightgray white
01110
11100
10000
10000
00001
(todo: horizontal magnet. if > represents a horizontal magnet with pos on the left & neg on the right, and ^ represents a vertical magnet, this should happen:
>^
> >
)
=======
LEGEND
=======
. = Background
# = Wall
P = Player
! = Magnet:PosNegV
i = Magnet:NegPosV
g = goal
* = Metal
Magnet = Magnet:PosNegV or Magnet:NegPosV
=======
SOUNDS
=======
Magnet MOVE 36772507
================
COLLISIONLAYERS
================
Background
Goal
Player, Wall, Magnet, Metal
======
RULES
======
(
todo!
a magnet which hits a wall on its left side should carry a "right failed" signal.
that "right failed" signal spreads to other magnets in direct contact with it.
the "right failed" signal denotes that the object moving right has hit an object and failed to move.
magnets use their right filed signal to e.g. stop a metal block from moving due to an unsuccessful magnet push.
)
[ > Player | Magnet ] -> [ > Player | > Magnet ]
startLoop
vertical Polarity [moving Magnet:Polarity | Magnet:Polarity] -> [moving Magnet:Polarity | moving Magnet:Polarity]
horizontal Polarity [moving Magnet:Polarity | Magnet:OpposedPolarity] -> [moving Magnet:Polarity | moving Magnet:OpposedPolarity]
vertical [moving Magnet | stationary Metal] -> [moving Magnet | moving Metal]
UP Polarity [Magnet:Polarity | Magnet:OpposedPolarity] -> [DOWN Magnet:Polarity | UP Magnet:OpposedPolarity]
RIGHT Polarity [Magnet:Polarity | Magnet:Polarity] -> [LEFT Magnet:Polarity | RIGHT Magnet:Polarity]
[ > Magnet | Player] -> [ > Magnet | > Player ]
[ > Magnet | Magnet] -> [ > Magnet | > Magnet]
[ > Metal | stationary Magnet] -> [ > Metal | > Magnet]
[ > Metal | Metal] -> [ > Metal | > Metal ]
vertical [no Magnet | Metal | no Metal no Magnet | Magnet ] -> [ | > Metal | | Magnet ]
endLoop
late vertical Polarity [Magnet:Polarity | Magnet:OpposedPolarity] -> [Magnet:Polarity | Magnet:OpposedPolarity] again
late horizontal Polarity [Magnet:Polarity | Magnet:Polarity] -> [Magnet:Polarity | Magnet:Polarity ] again
late vertical Polarity [Magnet | | Metal] -> [Magnet | | Metal ] again
==============
WINCONDITIONS
==============
All Player on Goal
=======
LEVELS
=======
(
(jcygo)
########g##
##!.......#
#......i..#
#.!..i....#
#..!......#
#.........#
##p########
)
(ncrecc)
########g##
##i..###.##
#...!.##.##
#.!...#.!##
#..#......#
##.#......#
##p########
(ncrecc)
########p##
#.........#
#.!...!.i.#
#....i....#
#..!....!.#
##i#......#
##g########
(ncrecc)
###g#######
###....i.##
#######...#
#.........#
#****.i...#
##..##*#..#
#....i.#..#
#......####
##p########
(ncrecc)
###p#######
#.......#*#
#.i.....###
#.......#*#
#.#.....###
#.......#*#
#.!.#***###
#...#***#*#
######g####
message sketches
(ncrecc)
#####g##
####.!##
#p!.!..#
#.....##
########
(ncrecc)
#######
#..*..#
#...#.#
#p!.!*.
#...#g#
#######
(ncrecc)
message rudimentary key-and-door system
message like level 2 but much more remote
message for this to be taken full advantage of larger levels would probably need to be used
############
#..........#
#.....i....#
#.p#i.#....#
####i.#....#
#..#i.#....#
#..#i!i!...#
#..####!...#
#.....g.#..#
#....##.#..#
############
message perhaps levels start out small and gradually get larger and larger until something like this is feasible?
message perhaps introduce some mechanic which can transmit magnetic attraction from one space to another without needing to use physical magnets?
message would be nice if there were just a small amount of mechanics that can achieve a lot when used together
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment