You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build a component to store effects that can be applied on any character, think of it as a buff / debuff in a RPG game.
How would you manage to add / remove those buffs / debuffs?
Component:
import{defineQuery}from'bitecs'consteffectQuery=defineQuery([Effect])consteffectSystem=(world: IMyWorld)=>{constentities=effectQuery(world)entities.forEach((entity)=>{Effect.effects[entity].forEach((effect)=>{// remove effect if some condition is met})// if some condition is met, add an effect)if(true){consteffectId=12Effect.effects[entity].push(effectId)}})}
Thanks!
The text was updated successfully, but these errors were encountered:
I'm trying to build a component to store effects that can be applied on any character, think of it as a buff / debuff in a RPG game.
How would you manage to add / remove those buffs / debuffs?
Component:
System:
Thanks!
The text was updated successfully, but these errors were encountered: