Skip to content

Instantly share code, notes, and snippets.

@caogtaa
Created January 16, 2025 00:56
Show Gist options
  • Save caogtaa/74403a5ae69b72795e160c8b7c199577 to your computer and use it in GitHub Desktop.
Save caogtaa/74403a5ae69b72795e160c8b7c199577 to your computer and use it in GitHub Desktop.
Mind Force (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
title Mind Force
author [email protected]
again_interval 0.16
run_rules_on_level_start
(verbose_logging)
========
OBJECTS
========
Background
(#A3FFFF)
#dadad8
Wall
gray darkgray
00010
11111
01000
11111
00010
NPlayer
Black #FFD9BF red Blue
.000.
.111.
22222
.333.
.3.3.
HPlayer (Player that owns a HoldingCrate,为了方便控制,在同步模式下直接切换玩家)
Black #FFD9BF red Blue #1dc116
.000.
.141.
24442
.343.
.3.3.
(Debug color for markers)
(
HumanJumpRight
red
HumanJumpLeft
red
JumpableChecker
yellow
JumpDoneMarker
white
)
HumanJumpRight
transparent
HumanJumpLeft
transparent
JumpableChecker
transparent
JumpDoneMarker
transparent
BlockMoveMarker
blue
DeadHuman
black Orange red Blue #1dc116
.020.
.222.
22222
.222.
.2.2.
Crate
#71451d #8c5424 #a3632c
11111
10001
10001
10001
11111
HoldingCrate
#71451d #8c5424 #a3632c #1dc116
11111
10301
13331
10301
11111
(
Crate
#71451d #824e21 #965927 orange
00112
03332
03132
03332
00011
HoldingCrate
#71451d #824e21 #965927 orange #1dc116
04442
43434
44444
43434
04441
)
(
#1dc116 Orange
10001
01010
00000
01010
10001
)
Spike
gray white
..0..
..0..
.010.
.001.
00001
HoldingSpike
gray white #1dc116
..0..
..2..
.222.
.021.
00001
Aim
#1dc116
.000.
0...0
0.0.0
0...0
.000.
Exit
#71451d black
.000.
01110
01110
01110
01110
=======
LEGEND
=======
. = Background
# = Wall
P = NPlayer
O = Crate
E = Exit
* = Spike
(关卡调试用)
2 = HPlayer
C = HoldingCrate
S = HoldingSpike
Player = NPlayer or HPlayer or Aim
HumanJump = HumanJumpLeft or HumanJumpRight
Human = NPlayer or HPlayer
Holdable = Crate or Spike (holdable专指尚未被控制的物体)
Holding = HoldingCrate or HoldingSpike (holding专指正在被控制的物体)
Object = Human or wall or Holdable or Holding
Stable = wall or Holdable
ObjectOrJump = Object or HumanJump
=======
SOUNDS
=======
(Crate MOVE 36772507) (TODO: add sound later)
undo 21150709
endlevel 33645300
sfx0 16961500 (锁定holdable)
(sfx1 27137709 (取消选中))
sfx1 76110109 (取消选中)
sfx2 63043704 (死亡)
sfx3 25391905 (跳跃)
sfx4 55776908 (开始瞄准)
================
COLLISIONLAYERS
================
Background
Exit
Object
DeadHuman
Aim
HumanJump
JumpDoneMarker
JumpableChecker
BlockMoveMarker
======
RULES
======
(取消上下移动输入,进入external stage后貌似这里就不起作用了,否则玩家永远无法下落)
[ UP Human ] -> [Human]
[ DOWN Human ] -> [Human]
(有Aim的情况下禁止角色移动)
[ moving Human ] [ Aim ] -> [ Human ] [ Aim ]
(在跳高的中间步骤不要移动)
[ moving Human ] [ HumanJump ] -> [ Human ] [ HumanJump ]
(TODO: 这一条后面会移除)
(经典推箱子逻辑)
([ > Human | Crate ] -> [ > Human | > Crate ])
[ action NPlayer ] -> [ HPlayer Aim ] sfx4 (进入框选模式)
[ action Aim no Holdable ] [ HPlayer ] -> [ no Holdable ] [ NPlayer ] sfx1 (未框选,返回正常模式)
[ action Aim Crate ] -> [ HoldingCrate ] sfx0 (进入同步模式)
[ action Aim Spike ] -> [ HoldingSpike ] sfx0
[ action HPlayer ] [ HoldingCrate ] -> [ NPlayer ] [ Crate ] sfx1 (退出同步模式,返回正常模式)
[ action HPlayer ] [ HoldingSpike ] -> [ NPlayer ] [ Spike ] sfx1
[moving Human] -> [moving Human] again
(By just having on down, the object instantly hits the ground because it applies the rule as many times as it can during)
(a single turn.)
(right [ Player | no Object ] -> [ | Player ]
right [ Crate | no Object no Player ] -> [ | Crate ])
(The crate gets stuck to the right wall like an anti gravity game)
(right [ Player | no Object ] -> [ | Player ]
right [ Crate | no Object no Player ] -> [ | Crate ])
(When you use the word 'random', it forces the rule to only be applied a single time per turn, so it only falls every time)
(you move.)
(random down [ Player | no Object ] -> [ | Player ]
random down [ Crate | no Object no Player ] -> [ | Crate ])
(If we use the again command we covered in the animation tutorial, now when we combine it with random and down, it will)
(it will only move it down one square per turn, but again will force the game to perform many turns until the action)
(cannot be performed anymore. Now we can see the animation of gravity being applied.)
(跟随下落逻辑,again关键字不断检测直到没有变化)
random down [ NPlayer | no ObjectOrJump ] -> [ down NPlayer | ] again (普通模式下玩家下落)
random down [ HPlayer | no ObjectOrJump ] [ Holding ] -> [ | HPlayer ] [ down Holding ] again (H模式下下落,总是带动H块)
random down [ holdable | no Object ] -> [ | holdable ] again
(特殊的,有站立在H块上的下落逻辑)
random down [ HPlayer | Holding no HumanJump | no ObjectOrJump ] -> [ | HPlayer | Holding ] again
down [ human | Spike ] -> [ DeadHuman | Spike ] sfx2 (被尖刺扎死,简单点先不主动end game)
down [ human | HoldingSpike ] -> [ DeadHuman | HoldingSpike ] sfx2 (被尖刺扎死,简单点先不主动end game)
(跳跃,两个方向分开处理。使用两帧处理上跳和水平移动,以便H块能跟随移动)
RIGHT [ > human | Stable ] -> [ ^ human HumanJumpRight | stable ] again
LEFT [ > human | Stable ] -> [ v human HumanJumpLeft | stable ] again
UP [ > human | no stable ] -> [ > human | JumpableChecker ] (生成一个临时节点,用于检测斜角是否有可以移动的空间)
RIGHT [stationary JumpableChecker | stable ] [ HumanJumpRight ] -> [ | stable ] [ ] (临时节点水平检测,检测失败就删除自己)
LEFT [stationary JumpableChecker | stable ] [ HumanJumpLeft ] -> [ | stable ] [ ]
UP [ > human | no JumpableChecker ] -> [ human | no JumpableChecker ] (如果临时节点被删除,取消human上移)
[JumpableChecker] -> [JumpableChecker] sfx3
[stationary human] [ HumanJumpRight ] [ no JumpDoneMarker ] -> [right human] [] [ JumpDoneMarker ] again
[stationary human] [ HumanJumpLeft ] [ no JumpDoneMarker ] -> [left human] [] [ JumpDoneMarker ] again
(UP [ NPlayerJumpRight | no Stable ] -> [ NPlayerJumpRight | v NPlayer ])
(UP [ NPlayerJumpLeft | no Stable ] -> [ NPlayerJumpLeft | ^ NPlayer ])
(late [ PlayerJump ] -> []) (消除跳跃标记)
late [JumpDoneMarker] -> []
late [JumpableChecker] -> []
(超距作用,同步移动)(BUG: hozirontal关键字无法概括LEFT+RIGHT)
LEFT [ LEFT HPlayer | no Stable ] [ Holding ] -> [ LEFT HPlayer | ] [ LEFT Holding ]
RIGHT [ RIGHT HPlayer | no Stable ] [ Holding ] -> [ RIGHT HPlayer | ] [ RIGHT Holding ]
UP [ UP HPlayer | no Stable ] [ Holding ] -> [ UP HPlayer | ] [ UP Holding ]
(up指定的是后面两个对象的位置关系)
(即当发现有一个player在H块之上时, H停止移动)
(up [ horizontal Holding | player] -> [Holding | player]) (TODO: 这一条作为feature来使用,因为多个箱子堆叠时力的传导不好实现)
(遇到障碍提前停止移动,避免污染后续的移动状态)
left [ left Holding | stationary object ] -> [ Holding | object ]
left [ left holdable | stationary object ] -> [ holdable | object ]
right [ right Holding | stationary object ] -> [ Holding | object ]
right [ right holdable | stationary object ] -> [ holdable | object ]
(底部的H块拖动会连带上方的块)
up [ moving Holding | holdable ] -> [ moving Holding | moving holdable ]
up [ moving holdable | holdable ] -> [ moving holdable | moving holdable ]
(重新清理一次移动状态)
left [ left Holding | stationary object ] -> [ Holding BlockMoveMarker | object ]
left [ left holdable | stationary object ] -> [ holdable BlockMoveMarker | object ]
right [ right Holding | stationary object ] -> [ Holding BlockMoveMarker | object ]
right [ right holdable | stationary object ] -> [ holdable BlockMoveMarker | object ]
(向上递推清理移动状态)
up [ BlockMoveMarker | moving holdable ] -> [ | holdable BlockMoveMarker ] again
(up [ BlockMoveMarker | moving holdable ] -> [ moving holdable | moving holdable ] again)
late [ BlockMoveMarker ] -> []
==============
WINCONDITIONS
==============
some Human on Exit
=======
LEVELS
=======
(for debug)
(
############
#........###
#........###
####.......#
####..p....#
####..o....#
####..o...e#
############
)
message level 1 of 8
message GieGie use mind force to control crates.
message X to aim, choose a crate and press X to start controlling, X again to release.
##########
##########
#........#
#p...o.e.#
####.#####
##########
message level 2 of 8
message GieGie cannot step up to a controlling crate.
##########
#........#
#........#
#p.o#...e#
######.###
######.###
##########
message level 3 of 8
##########
#........#
#.p.o...e#
###.##..##
###.##..##
#####..###
####..####
##...#####
##o..#####
##########
message level 4 of 8
message GieGie is good at "driving" crates.
##########
#........#
#........#
#p.o....e#
###****###
##########
message level 5 of 8
message GieGie can control traps too.
##########
#........#
#........#
#........#
#p.#*.*.e#
##########
message level 6 of 8
##########
#.......e#
#......###
#........#
##p.o.*..#
##########
message level 7 of 8
#########
#......e#
#......##
###...*##
#....####
#...o...#
#p..o...#
#########
message level 8 of 8
#########
#####o###
#####*###
#####*###
#####*###
#####*###
###..*..#
##...*..#
##.p.*.e#
#########
message Congratulations! You helped GieGie excape the cave.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment