renamed particle* to animation*, added asesprite animation loading
This commit is contained in:
@@ -57,16 +57,16 @@ func NewGameObserver(
|
||||
|
||||
playerID := ecs.ComponentID[components.Player](world)
|
||||
obstacleID := ecs.ComponentID[components.Obstacle](world)
|
||||
particleID := ecs.ComponentID[components.Particle](world)
|
||||
animationID := ecs.ComponentID[components.Animation](world)
|
||||
|
||||
playerListener := observer.GetListenerCallback(playerID)
|
||||
obstacleListener := observer.GetListenerCallback(obstacleID)
|
||||
particleListener := observer.GetListenerCallback(particleID)
|
||||
animationListener := observer.GetListenerCallback(animationID)
|
||||
|
||||
listen := listener.NewDispatch(
|
||||
&playerListener,
|
||||
&obstacleListener,
|
||||
&particleListener,
|
||||
&animationListener,
|
||||
)
|
||||
|
||||
world.SetListener(&listen)
|
||||
@@ -74,7 +74,7 @@ func NewGameObserver(
|
||||
observer.Entities = make(map[ecs.ID]map[ecs.Entity]int)
|
||||
observer.Entities[playerID] = make(map[ecs.Entity]int)
|
||||
observer.Entities[obstacleID] = make(map[ecs.Entity]int)
|
||||
observer.Entities[particleID] = make(map[ecs.Entity]int)
|
||||
observer.Entities[animationID] = make(map[ecs.Entity]int)
|
||||
|
||||
resmanger := generic.NewResource[GameObserver](world)
|
||||
resmanger.Add(observer)
|
||||
@@ -119,20 +119,20 @@ func (observer *GameObserver) GetObstacles() []ecs.Entity {
|
||||
return observer.GetEntities(obstacleID)
|
||||
}
|
||||
|
||||
func (observer *GameObserver) GetParticles() []ecs.Entity {
|
||||
particleID := ecs.ComponentID[components.Particle](observer.World)
|
||||
return observer.GetEntities(particleID)
|
||||
func (observer *GameObserver) GetAnimations() []ecs.Entity {
|
||||
animationID := ecs.ComponentID[components.Animation](observer.World)
|
||||
return observer.GetEntities(animationID)
|
||||
}
|
||||
|
||||
func (observer *GameObserver) RemoveEntities() {
|
||||
playerID := ecs.ComponentID[components.Player](observer.World)
|
||||
obstacleID := ecs.ComponentID[components.Obstacle](observer.World)
|
||||
particleID := ecs.ComponentID[components.Particle](observer.World)
|
||||
animationID := ecs.ComponentID[components.Animation](observer.World)
|
||||
|
||||
observer.Entities = make(map[ecs.ID]map[ecs.Entity]int)
|
||||
observer.Entities[playerID] = make(map[ecs.Entity]int)
|
||||
observer.Entities[obstacleID] = make(map[ecs.Entity]int)
|
||||
observer.Entities[particleID] = make(map[ecs.Entity]int)
|
||||
observer.Entities[animationID] = make(map[ecs.Entity]int)
|
||||
}
|
||||
|
||||
func (observer *GameObserver) SetupLevelScore(min []int) {
|
||||
|
||||
Reference in New Issue
Block a user