Skip to content

Instantly share code, notes, and snippets.

@m-ender
Last active November 9, 2022 22:57
Show Gist options
  • Save m-ender/e348c21bdd22217ef3f10483a54b207b to your computer and use it in GitHub Desktop.
Save m-ender/e348c21bdd22217ef3f10483a54b207b to your computer and use it in GitHub Desktop.
Tetraglyph (Pattern:Script Script)
Play this game by pasting the script in https://clementsparrow.github.io/Pattern-Script/src/editor.html
title Tetraglyph
author Menderbug
homepage menderbug.itch.io
background_color #350828
author_color #BE7DBC
text_color #F9CB60
keyhint_color #BE7DBC
sprite_size 9x9
run_rules_on_level_start
again_interval 0.1
key_repeat_interval 0.15
=====
TAGS
=====
U_ = up
L_ = left
R_ = right
D_ = down
CrateType = Push Pull Repel Swap
WireType = Floor_ Wall_ Trigger_
WireState = Active_ Inactive_
DoorState = Open_ Closed_
Frame = t6 t5 t4 t3 t2 t1 t0
WireType1 = WireType
WireType2 = WireType
Directions1 = directions
Directions2 = directions
DoorState1 = DoorState
DoorState2 = DoorState
=========
MAPPINGS
=========
Frame => NextFrame
t6 t5 t4 t3 t2 t1 t0 -> t5 t4 t3 t2 t1 t0 t0
WireState => OppositeWireState
Active_ Inactive_ -> Inactive_ Active_
DoorState => OppositeDoorState
Open_ Closed_ -> Closed_ Open_
========
OBJECTS
========
Background
#F9CB60 #F9960F
000000000
000000000
000000000
000000000
000010000
000000000
000000000
000000000
000000000
Wall
#350828
Pit
#350828
Player
#151244 #F9960F
0000.0000
001111100
011111110
011100110
.1100011.
011001110
011111110
001111100
0000.0000
Crate:Push
#BC2F01 #680703 #BC2F01
000000000
011111110
012111210
011222110
011212110
011222110
012111210
011111110
000000000
Crate:Pull
#BC2F01 #680703 #BC2F01
000000000
011111110
012212210
012222210
012222210
011222110
011121110
011111110
000000000
Crate:Repel
#BC2F01 #680703 #BC2F01
000000000
011111110
011121110
011221110
011111210
011212210
012211110
011111110
000000000
Crate:Swap
#BC2F01 #680703 #BC2F01
000000000
011111110
012211110
012212110
011111110
011212210
011112210
011111110
000000000
GlowingCrate:CrateType:Frame
transparent
GlowingCrate:CrateType:t2
#BC2F01 #680703 #F9960F
copy: Crate:CrateType
GlowingCrate:CrateType:t1
#F9960F #BC2F01 #F9CB60
copy: Crate:CrateType
GlowingCrate:CrateType:t0
#BC2F01 #680703 #F9960F
copy: Crate:CrateType
ActiveCrate:CrateType
#BC2F01 #680703 #F9960F
copy: Crate:CrateType
Trigger:CrateType
transparent #F9960F #F9CB60
copy: Crate:CrateType
Door:DoorState
transparent
Door:Open_
transparent #BC2F01
000000000
000010000
001010100
000000000
011111110
000000000
001010100
000010000
000000000
Door:Closed_
#60117f #BE7DBC
copy: Door:Open_
DoorAnimation:DoorState:Frame
transparent
DoorAnimation:Closed_:t1
#BE7DBC #F9960F
copy: Door:Open_
DoorAnimation:Closed_:t0
#922A95 #BE7DBC
copy: Door:Open_
DoorAnimation:Open_:t1
#922A95 #BE7DBC
copy: Door:Open_
DoorAnimation:Open_:t0
#BE7DBC #F9960F
copy: Door:Open_
Laser:directions
#922A95
.........
.........
.........
.........
000000000
.........
.........
.........
.........
rot:right:>
Goal
transparent #F9960F #F9CB60
.........
.1111111.
.1111111.
.1112211.
.1122211.
.1122111.
.1111111.
.1111111.
.........
Wire:Floor_:Inactive_:right
#F9960F #F9960F #F9960F
.........
.........
.........
.........
....01102
.........
.........
.........
.........
Wire:Floor_:Inactive_:directions
#F9960F #F9960F #F9960F
copy: Wire:Floor_:Inactive_:right rot:right:>
Wire:Floor_:Active_:directions
#BC2F01 #BC2F01 #BC2F01
copy: Wire:Floor_:Inactive_:directions
Wire:Wall_:Inactive_:directions
#F9960F transparent transparent
copy: Wire:Floor_:Inactive_:directions
Wire:Wall_:Active_:directions
#BC2F01 transparent transparent
copy: Wire:Floor_:Inactive_:directions
Wire:Trigger_:WireState:directions
transparent transparent #F9960F
copy: Wire:Floor_:Inactive_:directions
( Direction indicates which side borders non-wall tiles )
WallDeco:right
#BE7DBC
........0
........0
........0
........0
........0
........0
........0
........0
........0
WallDeco:directions
#BE7DBC
copy: WallDeco:right rot:right:>
( Direction indicates the side clockwise from the corner )
WallDecoCorner:right
#BE7DBC
........0
.........
.........
.........
.........
.........
.........
.........
.........
WallDecoCorner:directions
#BE7DBC
copy: WallDecoCorner:right rot:right:>
_Temp
pink
_Temp:CrateType
pink
_Temp:directions
pink
_DoorClosing
pink
_DoorWas:DoorState
pink
_DoorWillBe:DoorState
pink
_WireGoing:WireState
transparent
=======
LEGEND
=======
. = Background
# = Wall
P = Player and Trigger:Repel
N = Crate:Push
E = Crate:Pull
S = Crate:Repel
W = Crate:Swap
1 = Trigger:Push
2 = Trigger:Pull
3 = Trigger:Repel
4 = Trigger:Swap
Ẅ = ActiveCrate:Push and Trigger:Push
Ü = ActiveCrate:Pull and Trigger:Pull
Ḇ = ActiveCrate:Repel and Trigger:Repel
Ṟ = ActiveCrate:Swap and Trigger:Swap
_ = Pit
* = Goal
+ = Door:Closed_
- = Door:Open_
─ = Wire:Floor_:Inactive_:L_ and Wire:Floor_:Inactive_:R_
│ = Wire:Floor_:Inactive_:U_ and Wire:Floor_:Inactive_:D_
┌ = Wire:Floor_:Inactive_:D_ and Wire:Floor_:Inactive_:R_
┐ = Wire:Floor_:Inactive_:L_ and Wire:Floor_:Inactive_:D_
└ = Wire:Floor_:Inactive_:U_ and Wire:Floor_:Inactive_:R_
┘ = Wire:Floor_:Inactive_:L_ and Wire:Floor_:Inactive_:U_
━ = Wire:Floor_:Active_:L_ and Wire:Floor_:Active_:R_
┃ = Wire:Floor_:Active_:U_ and Wire:Floor_:Active_:D_
┏ = Wire:Floor_:Active_:D_ and Wire:Floor_:Active_:R_
┓ = Wire:Floor_:Active_:L_ and Wire:Floor_:Active_:D_
┗ = Wire:Floor_:Active_:U_ and Wire:Floor_:Active_:R_
┛ = Wire:Floor_:Active_:L_ and Wire:Floor_:Active_:U_
═ = Wire:Wall_:Inactive_:L_ and Wire:Wall_:Inactive_:R_ and Wall
║ = Wire:Wall_:Inactive_:U_ and Wire:Wall_:Inactive_:D_ and Wall
╔ = Wire:Wall_:Inactive_:D_ and Wire:Wall_:Inactive_:R_ and Wall
╗ = Wire:Wall_:Inactive_:L_ and Wire:Wall_:Inactive_:D_ and Wall
╚ = Wire:Wall_:Inactive_:U_ and Wire:Wall_:Inactive_:R_ and Wall
╝ = Wire:Wall_:Inactive_:L_ and Wire:Wall_:Inactive_:U_ and Wall
╪ = Wire:Wall_:Active_:L_ and Wire:Wall_:Active_:R_ and Wall
╫ = Wire:Wall_:Active_:U_ and Wire:Wall_:Active_:D_ and Wall
╓ = Wire:Wall_:Active_:D_ and Wire:Wall_:Active_:R_ and Wall
╖ = Wire:Wall_:Active_:L_ and Wire:Wall_:Active_:D_ and Wall
╙ = Wire:Wall_:Active_:U_ and Wire:Wall_:Active_:R_ and Wall
╜ = Wire:Wall_:Active_:L_ and Wire:Wall_:Active_:U_ and Wall
Wire = Wire:WireType:WireState:directions
Door = Door:DoorState
Crate = Crate:CrateType
Movable = Player or Crate
=======
SOUNDS
=======
Crate:CrateType move 98127707
ActiveCrate:CrateType move 98127707
GlowingCrate:CrateType:t2 create 82946903
Wire create 38476507
sfx0 49593708 (power down)
sfx1 4017903 (power up)
sfx2 23100708 (door open/close)
endlevel 68360900
================
COLLISIONLAYERS
================
Background
Pit
Trigger:CrateType
Door:Open_
DoorAnimation:DoorState:Frame
Laser:directions
directions -> Wire:Floor_:WireState:directions, Wire:Trigger_:WireState:directions
Player, Crate:CrateType, ActiveCrate:CrateType, Wall, Door:Closed_
Goal
GlowingCrate:CrateType:Frame
directions -> WallDeco:directions
directions -> WallDecoCorner:directions
directions -> Wire:Wall_:WireState:directions
_WireGoing:WireState
_Temp
_DoorClosing
_DoorWas:DoorState
_DoorWillBe:DoorState
CrateType -> _Temp:CrateType
directions -> _Temp:directions
======
RULES
======
( Visuals )
[ Wall no WallDeco:> | no Wall ] -> [ Wall WallDeco:> | ]
[ Wall no WallDeco:^ | WallDeco:^ ] -> [ Wall _Temp:^ | WallDeco:^ ]
[ _Temp:> | WallDeco:v ] -> [ _Temp:> WallDecoCorner:v | WallDeco:v ]
[ _Temp:> ] -> [ ]
WireState [ Trigger:CrateType no Wire | Wire:WireType:WireState:< ] -> [ Trigger:CrateType Wire:Trigger_:WireState:> | Wire:WireType:WireState:< ]
CrateType [ ActiveCrate:CrateType ] -> [ Crate:CrateType ]
( Animation )
[ GlowingCrate:CrateType:t0 ] -> [ ]
CrateType Frame [ GlowingCrate:CrateType:Frame no _Temp ] -> [ GlowingCrate:CrateType:NextFrame _Temp ] again
[ _Temp ] -> [ ]
DoorState [ DoorAnimation:DoorState:t0 ] -> [ Door:DoorState ]
DoorState Frame [ DoorAnimation:DoorState:Frame no _Temp ] -> [ DoorAnimation:DoorState:NextFrame _Temp ] again
[ _Temp ] -> [ ]
( Swapping, laser is created in previous turn )
[ Crate:Swap | ... | Laser:> Crate ] -> [ Crate | ... | Crate:Swap ]
[ Laser:> ] -> [ ]
( Movement )
[ > Movable | Crate:Push ] -> [ > Movable | > Crate:Push ]
+ [ < Movable | Crate:Pull ] -> [ < Movable | < Crate:Pull ]
+ [ Player | Crate:Repel ] -> [ Player | > Crate:Repel ]
+ [ Player | no Wall | Crate:Repel ] -> [ Player | | > Crate:Repel ]
+ [ > Movable | Crate:Swap | ] -> [ > Movable | Crate:Swap | Laser:> ] again ( TODO: sfx )
( Extend swap laser )
[ Laser:> no Crate | no Wall ] -> [ Laser:> | Laser:> ]
[ Laser:> Wall ] -> [ ]
(############ late rules ############)
( TODO: Animate )
( TODO: only do this if there's no again turn so that repel crates can push across pits )
late [ Movable Pit ] -> [ Pit ]
( Trigger another turn to repel crates )
late [ Player | Crate:Repel ] -> again
late [ Player | no Wall | Crate:Repel ] -> again
( Visuals )
late CrateType [ Crate:CrateType Trigger:CrateType ] -> [ ActiveCrate:CrateType Trigger:CrateType ]
late CrateType [ ActiveCrate:CrateType no Trigger:CrateType ] -> [ Crate:CrateType ]
( Activate and deactivate wires )
late CrateType [ ActiveCrate:CrateType Trigger:CrateType Wire:Trigger_:Inactive_:> ] -> [ ActiveCrate:CrateType Trigger:CrateType Wire:Trigger_:Active_:> _WireGoing:Active_ ] sfx1
late CrateType [ no ActiveCrate:CrateType Trigger:CrateType Wire:Trigger_:Active_:> ] -> [ Trigger:CrateType Wire:Trigger_:Inactive_:> _WireGoing:Inactive_ ] sfx0
( Propagate wires )
late WireType2 WireState [ _WireGoing:WireState no _Temp Wire:WireType:WireState:> | Wire:WireType2:OppositeWireState:< ] -> [ Wire:WireType:WireState:> | Wire:WireType2:WireState:< _WireGoing:WireState _Temp ] again
late WireType WireState Directions2 [ _WireGoing:WireState no _Temp Wire:WireType:WireState:> Wire:WireType:OppositeWireState:Directions2] -> [ _WireGoing:WireState _Temp Wire:WireType:WireState:> Wire:WireType:WireState:Directions2 ] again
late [ _WireGoing:WireState no _Temp ] -> [ ]
late [ _Temp ] -> [ ]
( Open/close doors )
late DoorState1 [ Door:DoorState1 no _DoorWas:DoorState ] -> [ _DoorWillBe:Closed_ _DoorWas:DoorState1 ]
late [ Wire:WireType:Active_:> | _DoorWillBe:Closed_ ] -> [ Wire:WireType:Active_:> | _DoorWillBe:Open_ ]
late DoorState [ _DoorWillBe:DoorState _DoorWas:OppositeDoorState ] -> [ DoorAnimation:DoorState:t1 ] sfx2
late DoorState [ _DoorWillBe:DoorState _DoorWas:DoorState ] -> [ Door:DoorState ]
==============
WINCONDITIONS
==============
All Trigger:Push on ActiveCrate:Push
All Trigger:Pull on ActiveCrate:Pull
All Trigger:Repel on ActiveCrate:Repel
All Trigger:Swap on ActiveCrate:Swap
All Goal on Player
=======
LEVELS
=======
(
─│ ═║
┌┐ ╔╗
└┘ ╚╝
)
#################
#...............#
#.1.....n.....4.#
#...............#
#...............#
#......_#_......#
#...............#
#...._....._....#
#.w..#..p..#..e.#
#...._....._....#
#...............#
#......_#_......#
#...............#
#...............#
#.2.....s.....*.#
#...............#
#################
(
########################
##...####.....##########
##.*.###┌┐swe..+.....###
##...##╔+3#.n.#║##..n###
╔══+###╚4....##╚═4.wse.#
║.....##1#.#########...#
║..p..##║#s###########.#
║.....##╚═+###########+╗
║.....####.###########.║
║.n.e.##.....#########.║
║.....#╓━ḇ.n..###...#..║
║.....#╫.......+..#w.s4╝
╚─2.1.+-..s.4.#║#..ww###
#...│.║##...│.#║##...###
####╚═╝#####╚══╝########
)
(
#######*
#...#..#
#.#g.u4#
#..gg###
##p..###
########
#######*
###..###
###r..##
#.wgw.4#
#p..####
########
########
##.....#
#┌┐bub.p
╔+4#.w.#
╚1....##
#2═+####
###b###*
##########...
##p......#.#.
##.wubrg.####
##┌1..4..#.#.
##│...└┐.+┐..
##╚═+#.└─═┘#.
.....#...#.#.
.....#####.#.
.............
.╭┬╮.......#.
.├┼┤.........
.╰┴╯.......*.
.............
*########
#..┌+┐..#
#..│.│..#
#..│.│..#
#..1.2..#
#..w.u..#
#p......#
#########
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment