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"` D directionType `json:"Direction"`
S int `json:"Speed"` S int `json:"Speed"`
T string `json:"Transparent"` T string `json:"Transparent"`
V int `json:"V-Offset"`
Repeat bool Repeat bool
Frames map[int]([][]rune) Frames map[int]([][]rune)
} }
@ -67,7 +68,7 @@ func (lvl *Level) Height() int {
max := 0 max := 0
for _, l := range lvl.Layers { for _, l := range lvl.Layers {
for _, f := range l.Frames { for _, f := range l.Frames {
if len(f) > max { if (len(f) + l.V) > max {
max = len(f) max = len(f)
} }
} }
@ -108,7 +109,7 @@ type zString struct {
} }
type ByZ []zString 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) 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 } func (a ByZ) Less(i, j int) bool { return a[i].z < a[j].z }

View File

@ -3,11 +3,12 @@
"FPS": 25, "FPS": 25,
"Layers" : { "Layers" : {
"locomotive": { "locomotive": {
"Z-Index": 0, "Z-Index": 2,
"Direction": 4, "Direction": 4,
"Speed": 3, "Speed": 3,
"V-Offset": 7,
"Repeat": false, "Repeat": false,
"Transparent": "r" "Transparent": " "
}, },
"ground": { "ground": {
"Z-Index": 1, "Z-Index": 1,
@ -22,6 +23,13 @@
"Speed": 2, "Speed": 2,
"Repeat": false, "Repeat": false,
"Transparent": " " "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 * _o
| / | /
===v=================--=================-==============--======-===========-==== ===v=================--=================-==============--======-===========-====

View File

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

View File

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

View File

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

View File

@ -1,3 +1,10 @@
==== ________ ___________ ==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________| _D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___| _________________ |(_)--- | H\________/ | | =|___ ___| _________________

View File

@ -1,3 +1,10 @@
==== ________ ___________ ==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________| _D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___| _________________ |(_)--- | H\________/ | | =|___ ___| _________________

View File

@ -1,3 +1,10 @@
==== ________ ___________ ==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________| _D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___| _________________ |(_)--- | H\________/ | | =|___ ___| _________________

View File

@ -1,3 +1,10 @@
==== ________ ___________ ==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________| _D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___| _________________ |(_)--- | H\________/ | | =|___ ___| _________________

View File

@ -1,3 +1,10 @@
==== ________ ___________ ==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________| _D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___| _________________ |(_)--- | H\________/ | | =|___ ___| _________________

View File

@ -1,3 +1,10 @@
==== ________ ___________ ==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________| _D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___| _________________ |(_)--- | H\________/ | | =|___ ___| _________________