title Colour Chained
author Dennis Au
youtube _VzrmRkLfxM
run_rules_on_level_start
again_interval 0.015
noundo

(version 201310152126 - added some harder levels, added sfx for rotate and drop, decided to use noundo)
(version 201310142256 - tweaked scoring, added pop animation and reworked code)

========
OBJECTS
========
Background
Black

P1 p
Black
0...0
.....
.....
.....
0...0

P2 q
Black
0...0
.....
.....
.....
0...0

hasN
Orange
0....
.....
.....
.....
....0

Remove
White
.....
.....
.....
.....
.....


NP1 n
White
.....
.....
.....
.....
.....

NP2 m
White
.....
.....
.....
.....
.....

LoseFlag
Grey Black LightGrey
.....
10120
.....
02010
.....

PieceGen
Black

HBorder -
DarkGrey
.....
.....
0...0
.....
.....

VBorder |
DarkGrey
..0..
.....
.....
.....
..0..

(pieces)
C1 R
Red LightGrey Black
.000.
00010
00000
00000
.000.

C2 G
Green LightGrey Black
.000.
00010
00000
00000
.000.

C3 B
Blue LightGrey Black
.000.
00010
00000
00000
.000.

C4 Y
Yellow LightGrey Black
.000.
00010
00000
00000
.000.

(Numbers)
No1 1
DarkGrey
..0..
.00..
..0..
..0..
.000.

No2 2
DarkGrey
.00..
0..0.
..0..
.0...
0000.

No3 3
DarkGrey
000..
...0.
.00..
...0.
000..

No4 4
DarkGrey
..0..
.00..
0.0..
0000.
..0..

No5 5
DarkGrey
0000.
0....
000..
...0.
000..

No6 6
DarkGrey
.00..
0....
000..
0..0.
.00..

No7 7
DarkGrey
0000.
...0.
..0..
.0...
0....

No8 8
DarkGrey
.00..
0..0.
.00..
0..0.
.00..

No9 9
DarkGrey
.00..
0..0.
.000.
...0.
.00..

No0 0
DarkGrey
.00..
0..0.
0..0.
0..0.
.00..

Pop
LightGrey White
...1.
..101
...1.
.....
.....

Inc
Black

PlayArea
Green


=======
LEGEND
=======
. = Background
u = PieceGen
+ = Inc

Player = P1 or P2
Piece = C1 or C2 or C3 or C4
PieceB = Piece

NP = NP1 or NP2
Border = HBorder or VBorder
Score = No1 or No2 or No3 or No4 or No5 or No6 or No7 or No8 or No9 or No0

Obstacle = Piece or Score
Match3Logic = hasN or Remove or Pop

=======
SOUNDS
=======
startlevel 17589703

(death)
sfx0 45317502

(match3)
sfx1 530500

(piece drop)
sfx2 75273507

(piece rotate)
sfx3 21774107

================
COLLISIONLAYERS
================
PlayArea
Background
Player, NP, PieceGen, Border
Piece, Score, Inc, 
Match3Logic, LoseFlag

======
RULES
======
(set preview area)
[] -> [PlayArea]
Down [NP|PlayArea] -> [NP|]
Vertical [No PlayArea| PlayArea] -> [|]

(match 3 rules)
Right [C1|C1] -> [C1 hasN|C1 hasN]
Right [C2|C2] -> [C2 hasN|C2 hasN]
Right [C3|C3] -> [C3 hasN|C3 hasN]
Right [C4|C4] -> [C4 hasN|C4 hasN]

Vertical [C1 hasN|C1] -> [Remove C1| Remove C1]
Vertical [C2 hasN|C2] -> [Remove C2| Remove C2]
Vertical [C3 hasN|C3] -> [Remove C3| Remove C3]
Vertical [C4 hasN|C4] -> [Remove C4| Remove C4]

[Remove C1| C1] -> [Remove C1| Remove C1]
[Remove C2| C2] -> [Remove C2| Remove C2]
[Remove C3| C3] -> [Remove C3| Remove C3]
[Remove C4| C4] -> [Remove C4| Remove C4]

[C1|C1|C1] -> [Remove C1|Remove C1|Remove C1]
[C2|C2|C2] -> [Remove C2|Remove C2|Remove C2]
[C3|C3|C3] -> [Remove C3|Remove C3|Remove C3]
[C4|C4|C4] -> [Remove C4|Remove C4|Remove C4]

[hasN] -> []

[PlayArea Remove Piece][P1] -> [PlayArea Pop][P1] sfx1
random [Pop][inc] -> [][left inc] again


(down drops pieces)
Down [> Player Piece|No Piece] -> [Player|> Piece] sfx2
Down [> Player No Piece] -> Cancel


(x rotates clockwise)
[Up P1|P2] -> [> P1|v P2] sfx3
[Action P1|P2] -> [> P1|v P2] sfx3
[Moving Player Piece] -> [Moving Player Moving Piece]
[> Player| Border] -> cancel


(gravity)
Down [PlayArea Piece No Player|No Obstacle][stationary inc] -> [PlayArea|> Piece][stationary inc] again


(explicit loss if piece ends on border)
[Piece Border][stationary inc][P1] -> [Piece Border LoseFlag][inc][] sfx0
[LoseFlag|No LoseFlag] -> [LoseFlag|LoseFlag] again


(scoring)

left [> inc| score] -> [> inc| > score]
left [> No9| score] -> [No0|> score]
left [> No9| border] -> [No0| border]

left [> No0] -> [No1]
left [> No1] -> [No2]
left [> No2] -> [No3]
left [> No3] -> [No4]
left [> No4] -> [No5]
left [> No5] -> [No6]
left [> No6] -> [No7]
left [> No7] -> [No8]
left [> No8] -> [No9]


(preview area)

startloop
(for endless mode)
[PieceGen No Piece] -> [PieceGen Random Piece]
(antigrav)
Up [Piece No PlayArea No NP| No Obstacle] -> [|> Piece]
(get next piece)
[P1 no Piece][P2 no Piece][NP1 Piece|NP2 PieceB]-> [P1 Piece][P2 PieceB][NP1|NP2]
endloop


==============
WINCONDITIONS
==============
No Piece
No Pop

=======
LEVELS
=======
(Empty Level Template

nm|..pq..|
..|......|
..|------|
..|......|
..|......|
..|......|
..|......|
..|......|
..|......|
..|000000+

)

nm|..pq..|
RR|......|
..|------|
..|......|
..|......|
..|......|
..|..Y...|
..|..RR..|
..|R.YY..|
..|000000+

nm|..pq..|
GR|......|
..|------|
..|......|
..|......|
..|....B.|
..|...BG.|
..|...RG.|
..|.R.RB.|
..|000000+

nm|..pq..|
RR|......|
BB|------|
BR|......|
..|......|
..|......|
..|......|
..|....B.|
..|..RRB.|
..|000000+


nm|..pq..|
BG|......|
RB|------|
..|......|
..|......|
..|......|
..|......|
..|..GB..|
..|RRGB..|
..|000000+

nm|..pq..|
BG|......|
GB|------|
..|......|
..|......|
..|......|
..|...G..|
..|..BB..|
..|..GG.B|
..|000000+

nm|..pq..|
RG|......|
GB|------|
BR|......|
..|......|
..|......|
..|...G..|
..|...B..|
..|..RRG.|
..|000000+

nm|..pq..|
GR|......|
RY|------|
BG|......|
YB|......|
..|......|
..|..B...|
..|..RB..|
..|.GYB..|
..|000000+

nm|..pq..|
RG|......|
YY|------|
YG|......|
BB|......|
..|BY....|
..|YB.G..|
..|YRRG..|
..|BGGBBY|
..|000000+

nm|..pq..|
rb|......|
bb|------|
by|......|
ry|......|
..|....r.|
..|...rb.|
..|.bybyb|
..|bybyrr|
..|000000+

nm|..pq..|
br|......|
ry|------|
yy|......|
..|....b.|
..|...gb.|
..|...yy.|
..|.bygb.|
..|byrgrr|
..|000000+


nm|..pq..|
by|......|
ry|------|
ry|......|
yg|....y.|
..|..rgby|
..|b.gbyg|
..|rrgbyg|
..|bbyyrr|
..|000000+


message Thank you for playing.
message Music: Puzzle Pieces - Desert of Lost Endings by Nick Tanski (nicholastanski.bandcamp.com)

(endless mode)
message Endless Mode unlocked!

nm|..pq..|
..|......|
..|------|
..|......|
..|......|
..|......|
..|......|
..|......|
..|......|
uu|000000+

(CC BY-NC-SA 3.0)