fix arche panic, by initializing colquery only when needed

This commit is contained in:
Thomas von Dein 2024-02-07 23:17:51 +01:00
parent a0b40139c7
commit a86f6c816f
2 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,6 @@ func NewLevel(game *Game, cellsize int, plan *assets.RawLevel) *Level {
func (level *Level) Update() {
query := level.World.Query(level.Selector["player"])
colquery := level.World.Query(level.Selector["collectible"])
for query.Next() {
playerposition := (*components.Position)(query.Get(level.Component["position"]))
@ -105,6 +104,7 @@ func (level *Level) Update() {
}
}
colquery := level.World.Query(level.Selector["collectible"])
for colquery.Next() {
collectible := (*components.Collectible)(colquery.Get(level.Component["collectible"]))
colposition := (*components.Position)(colquery.Get(level.Component["position"]))

BIN
openquell

Binary file not shown.