Fixed layer bound issue

This commit is contained in:
tkarrass 2016-02-08 20:07:53 +01:00
parent 937e824293
commit 6a342926b7
10 changed files with 96 additions and 5 deletions

View File

@ -168,7 +168,7 @@ func (lvl *Level) GetFrame(o, w, maxW, frameNo int) (ret *Frame) {
off += lW off += lW
} }
off %= lW off %= lW
log.Println(lW, off, o, w, maxW, frameNo) // log.Println(lW, off, o, w, maxW, frameNo)
if row < len(layer.Frames[f]) { if row < len(layer.Frames[f]) {
r := layer.Frames[f][row][:] r := layer.Frames[f][row][:]
for col := 0; col < w; col++ { for col := 0; col < w; col++ {
@ -185,6 +185,12 @@ func (lvl *Level) GetFrame(o, w, maxW, frameNo int) (ret *Frame) {
//for col := 0 //for col := 0
//log.Println(len(layer.Frames[f][row])) //log.Println(len(layer.Frames[f][row]))
//ret.Data[row] = append(ret.Data[row], (layer.Frames[f][row][off%w:])...) //ret.Data[row] = append(ret.Data[row], (layer.Frames[f][row][off%w:])...)
} else {
if zli == 0 {
for col := 0; col < w; col++ {
ret.Data[row][col] = rune(' ')
}
}
} }
} }
//} //}

View File

@ -3,7 +3,7 @@
"FPS": 25, "FPS": 25,
"Layers" : { "Layers" : {
"locomotive": { "locomotive": {
"Z-Index": 0, "Z-Index": 2,
"Direction": 4, "Direction": 4,
"Speed": 3, "Speed": 3,
"Repeat": false, "Repeat": false,

View File

@ -0,0 +1,12 @@
* _o
| /
===v=================--=================-==============--======-===========-====
|

View File

@ -0,0 +1,12 @@
O _x
| /
===v=================--=================-==============--======-===========-====
|

View File

@ -0,0 +1,12 @@
o *
\ |
===v=================--=================-==============--======-===========-====
|

View File

@ -0,0 +1,12 @@
X p
\ |
===v=================--=================-==============--======-===========-====
|

View File

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

View File

@ -0,0 +1,12 @@
O _x
| /
===v=================--=================-==============--======-===========-====
|

View File

@ -0,0 +1,12 @@
o *
\ |
===v=================--=================-==============--======-===========-====
|

View File

@ -0,0 +1,12 @@
X p
\ |
===v=================--=================-==============--======-===========-====
|