diff --git a/cmd/compile.go b/cmd/compile.go index bbc79a5..e4f287c 100644 --- a/cmd/compile.go +++ b/cmd/compile.go @@ -1,6 +1,8 @@ package cmd // code.bitsetter.de/fun/gosl/cmd import ( + "bytes" + "encoding/gob" "encoding/json" "fmt" "github.com/spf13/cobra" @@ -38,6 +40,7 @@ type LayerManifest struct { D directionType `json:"Direction"` S int `json:"Speed"` T string `json:"Transparent"` + Repeat bool Frames map[int]([][]rune) } @@ -118,7 +121,10 @@ func compile(cmd *cobra.Command, args []string) { } } } - + obuf := &bytes.Buffer{} + enc := gob.NewEncoder(obuf) + enc.Encode(&lvlMan) + ioutil.WriteFile(levelFile, obuf.Bytes(), 0644) } func init() { diff --git a/levels/locoworld/Manifest.json b/levels/locoworld/Manifest.json index d4a778e..20f3175 100644 --- a/levels/locoworld/Manifest.json +++ b/levels/locoworld/Manifest.json @@ -2,17 +2,19 @@ "Name": "The locomotive!", "FPS": 10, "Layers" : { - "locomotive": { - "Z-Index": 0, - "Direction": 6, - "Speed": 2, - "Transparent": "•" - }, - "background": { - "Z-Index": 1, - "Direction": 6, - "Speed": 1, - "Transparent": "•" - } + "locomotive": { + "Z-Index": 0, + "Direction": 6, + "Speed": 2, + "Repeat": false, + "Transparent": "•" + }, + "background": { + "Z-Index": 1, + "Direction": 6, + "Speed": 1, + "Repeat": true, + "Transparent": "•" + } } }