This commit is contained in:
tkarrass 2016-02-06 23:16:13 +01:00
parent 602949f1eb
commit f29cb4f8db
2 changed files with 21 additions and 13 deletions

View File

@ -1,6 +1,8 @@
package cmd // code.bitsetter.de/fun/gosl/cmd package cmd // code.bitsetter.de/fun/gosl/cmd
import ( import (
"bytes"
"encoding/gob"
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -38,6 +40,7 @@ type LayerManifest 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"`
Repeat bool
Frames map[int]([][]rune) 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() { func init() {

View File

@ -6,12 +6,14 @@
"Z-Index": 0, "Z-Index": 0,
"Direction": 6, "Direction": 6,
"Speed": 2, "Speed": 2,
"Repeat": false,
"Transparent": "•" "Transparent": "•"
}, },
"background": { "background": {
"Z-Index": 1, "Z-Index": 1,
"Direction": 6, "Direction": 6,
"Speed": 1, "Speed": 1,
"Repeat": true,
"Transparent": "•" "Transparent": "•"
} }
} }