From 5f6cd05f67fe60f2dcee54b63c9b5d697ed5211f Mon Sep 17 00:00:00 2001 From: tkarrass Date: Mon, 8 Feb 2016 21:58:33 +0100 Subject: [PATCH] Layer sorting bug fixed --- data/level.go | 5 +++-- levels/locoworld/Manifest.json | 12 ++++++++++-- levels/locoworld/fixed/1.frame | 14 ++++++++++++++ levels/locoworld/front/1.frame | 7 +++++++ levels/locoworld/ground/1.frame | 7 +++++++ levels/locoworld/ground/2.frame | 7 +++++++ levels/locoworld/ground/3.frame | 7 +++++++ levels/locoworld/ground/4.frame | 7 +++++++ levels/locoworld/locomotive/1.frame | 23 +++++++++++++++-------- levels/locoworld/locomotive/2.frame | 23 +++++++++++++++-------- levels/locoworld/locomotive/3.frame | 23 +++++++++++++++-------- levels/locoworld/locomotive/4.frame | 23 +++++++++++++++-------- levels/locoworld/locomotive/5.frame | 23 +++++++++++++++-------- levels/locoworld/locomotive/6.frame | 23 +++++++++++++++-------- 14 files changed, 152 insertions(+), 52 deletions(-) create mode 100644 levels/locoworld/fixed/1.frame diff --git a/data/level.go b/data/level.go index 2e0dde4..c950470 100644 --- a/data/level.go +++ b/data/level.go @@ -33,6 +33,7 @@ type Layer struct { D directionType `json:"Direction"` S int `json:"Speed"` T string `json:"Transparent"` + V int `json:"V-Offset"` Repeat bool Frames map[int]([][]rune) } @@ -67,7 +68,7 @@ func (lvl *Level) Height() int { max := 0 for _, l := range lvl.Layers { for _, f := range l.Frames { - if len(f) > max { + if (len(f) + l.V) > max { max = len(f) } } @@ -108,7 +109,7 @@ type zString struct { } type ByZ []zString -func (a ByZ) Len() int { return 1 } +func (a ByZ) Len() int { return len(a) } func (a ByZ) Swap(i, j int) { a[i], a[j] = a[j], a[i] } func (a ByZ) Less(i, j int) bool { return a[i].z < a[j].z } diff --git a/levels/locoworld/Manifest.json b/levels/locoworld/Manifest.json index ed0000c..a7c164d 100644 --- a/levels/locoworld/Manifest.json +++ b/levels/locoworld/Manifest.json @@ -3,11 +3,12 @@ "FPS": 25, "Layers" : { "locomotive": { - "Z-Index": 0, + "Z-Index": 2, "Direction": 4, "Speed": 3, + "V-Offset": 7, "Repeat": false, - "Transparent": "r" + "Transparent": " " }, "ground": { "Z-Index": 1, @@ -22,6 +23,13 @@ "Speed": 2, "Repeat": false, "Transparent": " " + }, + "fixed": { + "Z-Index": 0, + "Direction": 5, + "Speed": 2, + "Repeat": true, + "Transparent": " " } } } diff --git a/levels/locoworld/fixed/1.frame b/levels/locoworld/fixed/1.frame new file mode 100644 index 0000000..53760fc --- /dev/null +++ b/levels/locoworld/fixed/1.frame @@ -0,0 +1,14 @@ + +._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,- +_,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-. + + + + _|_ + /\ / \ + __/ \ / \ + / | __ __ / \ /\ /\ + _/ \/ \ / \ / \ _ / \ / \ + __ / / \ /\ ___ / \/ \ / \ _ / \ ___ / \ + / \/ \ _/ \ / \ / \ \/ \ / \ / \ / / \ + / \ \ / \___/ \ / / \ / \ \ / \ + / \ / / \ / \ \ / \ diff --git a/levels/locoworld/front/1.frame b/levels/locoworld/front/1.frame index 7f1a9b0..25fdc3e 100644 --- a/levels/locoworld/front/1.frame +++ b/levels/locoworld/front/1.frame @@ -7,6 +7,13 @@ + + + + + + + #######+ ######+##+ ##+##+ ##+##+ ##+##+ ##+#######+ ######+##+ ##+##+ ##+##+ ##+##+##+ ##+----/##+----/##| ##|##| ##|##| ##|##| ##|##+----/##+----/##| ##|##| ##|##| ##|##|##| #######+##| #######|##| ##|##| ##|##| ##|#######+##| #######|##| ##|##| ##|##|##| diff --git a/levels/locoworld/ground/1.frame b/levels/locoworld/ground/1.frame index 4a69b54..7409386 100644 --- a/levels/locoworld/ground/1.frame +++ b/levels/locoworld/ground/1.frame @@ -6,6 +6,13 @@ + + + + + + + * _o | / ===v=================--=================-==============--======-===========-==== diff --git a/levels/locoworld/ground/2.frame b/levels/locoworld/ground/2.frame index a29ae1d..06d5ccb 100644 --- a/levels/locoworld/ground/2.frame +++ b/levels/locoworld/ground/2.frame @@ -6,6 +6,13 @@ + + + + + + + O _x | / ===v=================--=================-==============--======-===========-==== diff --git a/levels/locoworld/ground/3.frame b/levels/locoworld/ground/3.frame index d5e518f..08005ae 100644 --- a/levels/locoworld/ground/3.frame +++ b/levels/locoworld/ground/3.frame @@ -6,6 +6,13 @@ + + + + + + + o * \ | ===v=================--=================-==============--======-===========-==== diff --git a/levels/locoworld/ground/4.frame b/levels/locoworld/ground/4.frame index 2629681..7399581 100644 --- a/levels/locoworld/ground/4.frame +++ b/levels/locoworld/ground/4.frame @@ -6,6 +6,13 @@ + + + + + + + X p \ | ===v=================--=================-==============--======-===========-==== diff --git a/levels/locoworld/locomotive/1.frame b/levels/locoworld/locomotive/1.frame index d805eb8..3afdc61 100644 --- a/levels/locoworld/locomotive/1.frame +++ b/levels/locoworld/locomotive/1.frame @@ -1,10 +1,17 @@ - ==== ________ ___________ - _D _| |_______/ \__I_I_____===__|_________| - |(_)--- | H\________/ | | =|___ ___| _________________ - / | | H | | | | ||_| |_|| _| \_____A - | | | H |__--------------------| [___] | =| | - | ________|___H__/__|_____/[][]~\_______| | -| | + + + + + + + + ==== ________ ___________ + _D _| |_______/ \__I_I_____===__|_________| + |(_)--- | H\________/ | | =|___ ___| _________________ + / | | H | | | | ||_| |_|| _| \_____A + | | | H |__--------------------| [___] | =| | + | ________|___H__/__|_____/[][]~\_______| | -| | |/ | |-----------I_____I [][] [] D |=======|____|________________________|_ __/ =| o |=-~~\ /~~\ /~~\ /~~\ ____Y___________|__|__________________________|_ - |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| - \_/ \_O=====O=====O=====O/ \_/ \_/ \_/ \_/ \_/ \ No newline at end of file + |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| + \_/ \_O=====O=====O=====O/ \_/ \_/ \_/ \_/ \_/ diff --git a/levels/locoworld/locomotive/2.frame b/levels/locoworld/locomotive/2.frame index a9ec49b..5191047 100644 --- a/levels/locoworld/locomotive/2.frame +++ b/levels/locoworld/locomotive/2.frame @@ -1,10 +1,17 @@ - ==== ________ ___________ - _D _| |_______/ \__I_I_____===__|_________| - |(_)--- | H\________/ | | =|___ ___| _________________ - / | | H | | | | ||_| |_|| _| \_____A - | | | H |__--------------------| [___] | =| | - | ________|___H__/__|_____/[][]~\_______| | -| | + + + + + + + + ==== ________ ___________ + _D _| |_______/ \__I_I_____===__|_________| + |(_)--- | H\________/ | | =|___ ___| _________________ + / | | H | | | | ||_| |_|| _| \_____A + | | | H |__--------------------| [___] | =| | + | ________|___H__/__|_____/[][]~\_______| | -| | |/ | |-----------I_____I [][] [] D |=======|____|________________________|_ __/ =| o |=-~~\ /~~\ /~~\ /~~\ ____Y___________|__|__________________________|_ - |/-=|___|= O=====O=====O=====O|_____/~\___/ |_D__D__D_| |_D__D__D_| - \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ \ No newline at end of file + |/-=|___|= O=====O=====O=====O|_____/~\___/ |_D__D__D_| |_D__D__D_| + \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ diff --git a/levels/locoworld/locomotive/3.frame b/levels/locoworld/locomotive/3.frame index 4d3545a..0e6322b 100644 --- a/levels/locoworld/locomotive/3.frame +++ b/levels/locoworld/locomotive/3.frame @@ -1,10 +1,17 @@ - ==== ________ ___________ - _D _| |_______/ \__I_I_____===__|_________| - |(_)--- | H\________/ | | =|___ ___| _________________ - / | | H | | | | ||_| |_|| _| \_____A - | | | H |__--------------------| [___] | =| | - | ________|___H__/__|_____/[][]~\_______| | -| | + + + + + + + + ==== ________ ___________ + _D _| |_______/ \__I_I_____===__|_________| + |(_)--- | H\________/ | | =|___ ___| _________________ + / | | H | | | | ||_| |_|| _| \_____A + | | | H |__--------------------| [___] | =| | + | ________|___H__/__|_____/[][]~\_______| | -| | |/ | |-----------I_____I [][] [] D |=======|____|________________________|_ __/ =| o |=-~O=====O=====O=====O\ ____Y___________|__|__________________________|_ - |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| - \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ \ No newline at end of file + |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| + \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ diff --git a/levels/locoworld/locomotive/4.frame b/levels/locoworld/locomotive/4.frame index 65752eb..f232514 100644 --- a/levels/locoworld/locomotive/4.frame +++ b/levels/locoworld/locomotive/4.frame @@ -1,10 +1,17 @@ - ==== ________ ___________ - _D _| |_______/ \__I_I_____===__|_________| - |(_)--- | H\________/ | | =|___ ___| _________________ - / | | H | | | | ||_| |_|| _| \_____A - | | | H |__--------------------| [___] | =| | - | ________|___H__/__|_____/[][]~\_______| | -| | + + + + + + + + ==== ________ ___________ + _D _| |_______/ \__I_I_____===__|_________| + |(_)--- | H\________/ | | =|___ ___| _________________ + / | | H | | | | ||_| |_|| _| \_____A + | | | H |__--------------------| [___] | =| | + | ________|___H__/__|_____/[][]~\_______| | -| | |/ | |-----------I_____I [][] [] D |=======|____|________________________|_ __/ =| o |=-O=====O=====O=====O \ ____Y___________|__|__________________________|_ - |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| - \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ \ No newline at end of file + |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| + \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ diff --git a/levels/locoworld/locomotive/5.frame b/levels/locoworld/locomotive/5.frame index febaf9e..a94ab8c 100644 --- a/levels/locoworld/locomotive/5.frame +++ b/levels/locoworld/locomotive/5.frame @@ -1,10 +1,17 @@ - ==== ________ ___________ - _D _| |_______/ \__I_I_____===__|_________| - |(_)--- | H\________/ | | =|___ ___| _________________ - / | | H | | | | ||_| |_|| _| \_____A - | | | H |__--------------------| [___] | =| | - | ________|___H__/__|_____/[][]~\_______| | -| | + + + + + + + + ==== ________ ___________ + _D _| |_______/ \__I_I_____===__|_________| + |(_)--- | H\________/ | | =|___ ___| _________________ + / | | H | | | | ||_| |_|| _| \_____A + | | | H |__--------------------| [___] | =| | + | ________|___H__/__|_____/[][]~\_______| | -| | |/ | |-----------I_____I [][] [] D |=======|____|________________________|_ __/ =| o |=-~~\ /~~\ /~~\ /~~\ ____Y___________|__|__________________________|_ - |/-=|___|=O=====O=====O=====O |_____/~\___/ |_D__D__D_| |_D__D__D_| - \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ \ No newline at end of file + |/-=|___|=O=====O=====O=====O |_____/~\___/ |_D__D__D_| |_D__D__D_| + \_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/ diff --git a/levels/locoworld/locomotive/6.frame b/levels/locoworld/locomotive/6.frame index 730a087..c49798b 100644 --- a/levels/locoworld/locomotive/6.frame +++ b/levels/locoworld/locomotive/6.frame @@ -1,10 +1,17 @@ - ==== ________ ___________ - _D _| |_______/ \__I_I_____===__|_________| - |(_)--- | H\________/ | | =|___ ___| _________________ - / | | H | | | | ||_| |_|| _| \_____A - | | | H |__--------------------| [___] | =| | - | ________|___H__/__|_____/[][]~\_______| | -| | + + + + + + + + ==== ________ ___________ + _D _| |_______/ \__I_I_____===__|_________| + |(_)--- | H\________/ | | =|___ ___| _________________ + / | | H | | | | ||_| |_|| _| \_____A + | | | H |__--------------------| [___] | =| | + | ________|___H__/__|_____/[][]~\_______| | -| | |/ | |-----------I_____I [][] [] D |=======|____|________________________|_ __/ =| o |=-~~\ /~~\ /~~\ /~~\ ____Y___________|__|__________________________|_ - |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| - \_/ \O=====O=====O=====O_/ \_/ \_/ \_/ \_/ \_/ \ No newline at end of file + |/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_| + \_/ \O=====O=====O=====O_/ \_/ \_/ \_/ \_/ \_/