Layer sorting bug fixed

This commit is contained in:
tkarrass 2016-02-08 21:58:33 +01:00
parent 7c5387421b
commit 5f6cd05f67
14 changed files with 152 additions and 52 deletions

View File

@ -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 }

View File

@ -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": " "
}
}
}

View File

@ -0,0 +1,14 @@
._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-
_,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-._,-.
+
_|_
/\ / \
__/ \ / \
/ | __ __ / \ /\ /\
_/ \/ \ / \ / \ _ / \ / \
__ / / \ /\ ___ / \/ \ / \ _ / \ ___ / \
/ \/ \ _/ \ / \ / \ \/ \ / \ / \ / / \
/ \ \ / \___/ \ / / \ / \ \ / \
/ \ / / \ / \ \ / \

View File

@ -7,6 +7,13 @@
#######+ ######+##+ ##+##+ ##+##+ ##+##+ ##+#######+ ######+##+ ##+##+ ##+##+ ##+##+##+
##+----/##+----/##| ##|##| ##|##| ##|##| ##|##+----/##+----/##| ##|##| ##|##| ##|##|##|
#######+##| #######|##| ##|##| ##|##| ##|#######+##| #######|##| ##|##| ##|##|##|

View File

@ -6,6 +6,13 @@
* _o
| /
===v=================--=================-==============--======-===========-====

View File

@ -6,6 +6,13 @@
O _x
| /
===v=================--=================-==============--======-===========-====

View File

@ -6,6 +6,13 @@
o *
\ |
===v=================--=================-==============--======-===========-====

View File

@ -6,6 +6,13 @@
X p
\ |
===v=================--=================-==============--======-===========-====

View File

@ -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/ \_/ \_/ \_/ \_/ \_/
|/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_|
\_/ \_O=====O=====O=====O/ \_/ \_/ \_/ \_/ \_/

View File

@ -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_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/
|/-=|___|= O=====O=====O=====O|_____/~\___/ |_D__D__D_| |_D__D__D_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/

View File

@ -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_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/
|/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/

View File

@ -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_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/
|/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/

View File

@ -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_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/
|/-=|___|=O=====O=====O=====O |_____/~\___/ |_D__D__D_| |_D__D__D_|
\_/ \__/ \__/ \__/ \__/ \_/ \_/ \_/ \_/ \_/

View File

@ -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_/ \_/ \_/ \_/ \_/ \_/
|/-=|___|= || || || |_____/~\___/ |_D__D__D_| |_D__D__D_|
\_/ \O=====O=====O=====O_/ \_/ \_/ \_/ \_/ \_/