renamed particle* to animation*, added asesprite animation loading
This commit is contained in:
@@ -2,6 +2,7 @@ package game
|
||||
|
||||
import (
|
||||
"image"
|
||||
"log"
|
||||
"log/slog"
|
||||
"openquell/assets"
|
||||
"openquell/components"
|
||||
@@ -51,7 +52,7 @@ func NewLevel(game *Game, cellsize int, plan *ldtkgo.Level) *Level {
|
||||
systemlist = append(systemlist,
|
||||
systems.NewPlayerSystem(game.World, gridcontainer, game.ScreenWidth, game.ScreenHeight))
|
||||
|
||||
systemlist = append(systemlist, systems.NewParticleSystem(game.World, game.Cellsize))
|
||||
systemlist = append(systemlist, systems.NewAnimationSystem(game.World, game.Cellsize))
|
||||
|
||||
systemlist = append(systemlist, systems.NewTransientSystem(game.World, gridcontainer))
|
||||
|
||||
@@ -197,6 +198,22 @@ func LevelToSlice(game *Game, level *ldtkgo.Level, tilesize int) (Map, Map) {
|
||||
}
|
||||
tileRect := entity.TileRect
|
||||
|
||||
animateondestruct := util.GetPropertyBool(entity, "AnimateOnDestruct")
|
||||
// FIXME: also check for AnimationLoop and other animation reasons
|
||||
if animateondestruct {
|
||||
tile.AnimateOnDestruct = true
|
||||
|
||||
animation := util.GetPropertyString(entity, "AnimateSpriteSheet")
|
||||
if animation != "" {
|
||||
if !util.Exists(assets.Animations, animation) {
|
||||
log.Fatalf("entity %s refers to non existent animation set %s",
|
||||
entity.Identifier, animation)
|
||||
}
|
||||
}
|
||||
|
||||
tile.AnimationSpriteSheet = assets.Animations[animation]
|
||||
}
|
||||
|
||||
tile.Sprite = tileset.SubImage(
|
||||
image.Rect(tileRect.X, tileRect.Y,
|
||||
tileRect.X+tileRect.W,
|
||||
|
||||
Reference in New Issue
Block a user