small fixes
This commit is contained in:
parent
720c9f305e
commit
8b0072d774
@ -44,8 +44,8 @@ type AnimationMeta struct {
|
|||||||
|
|
||||||
// Needed to thaw sprite set written by asesprite
|
// Needed to thaw sprite set written by asesprite
|
||||||
type AnimationJSON struct {
|
type AnimationJSON struct {
|
||||||
Meta AnimationMeta `json:"Meta"`
|
Meta AnimationMeta `json:"Meta"`
|
||||||
Frames []AnimationFrame `json:"frames"`
|
Frames map[string]AnimationFrame `json:"frames"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to store Animation data
|
// used to store Animation data
|
||||||
@ -133,7 +133,7 @@ func ReadJson(imagefile fs.DirEntry, fd fs.File) AnimationJSON {
|
|||||||
|
|
||||||
err := json.Unmarshal(buf.Bytes(), &animationjson)
|
err := json.Unmarshal(buf.Bytes(), &animationjson)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to parse JSON: %s", err)
|
log.Fatalf("failed to parse JSON in %s: %s", imagefile, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return animationjson
|
return animationjson
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import (
|
|||||||
"openquell/util"
|
"openquell/util"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/alecthomas/repr"
|
||||||
"github.com/hajimehoshi/ebiten/v2"
|
"github.com/hajimehoshi/ebiten/v2"
|
||||||
"github.com/mlange-42/arche/ecs"
|
"github.com/mlange-42/arche/ecs"
|
||||||
"github.com/solarlune/ldtkgo"
|
"github.com/solarlune/ldtkgo"
|
||||||
@ -168,7 +169,7 @@ func LevelToSlice(game *Game, level *ldtkgo.Level, tilesize int) (Map, Map) {
|
|||||||
|
|
||||||
case ldtkgo.LayerTypeEntity:
|
case ldtkgo.LayerTypeEntity:
|
||||||
// load mobile tiles (they call them entities) using static map map.png.
|
// load mobile tiles (they call them entities) using static map map.png.
|
||||||
tileset := assets.Assets["entitymap"]
|
tileset := assets.Assets["tilemap"]
|
||||||
|
|
||||||
for _, entity := range layer.Entities {
|
for _, entity := range layer.Entities {
|
||||||
if entity.TileRect != nil {
|
if entity.TileRect != nil {
|
||||||
@ -197,6 +198,7 @@ func LevelToSlice(game *Game, level *ldtkgo.Level, tilesize int) (Map, Map) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
tileRect := entity.TileRect
|
tileRect := entity.TileRect
|
||||||
|
repr.Println(tileRect)
|
||||||
|
|
||||||
tile.Sprite = tileset.SubImage(
|
tile.Sprite = tileset.SubImage(
|
||||||
image.Rect(tileRect.X, tileRect.Y,
|
image.Rect(tileRect.X, tileRect.Y,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user