Search the Community
Showing results for tags 'pixi ticker'.
-
Hi all, I am developing a simple 2D game with PIXI js and have created an FSM that controls game flow at a high level. During some of the transitions between game states it would be desirable to have some animations in the game halt while others continue on or change. I have read the docs for PIXI.ticker.Ticker and my proposed solution was to use the remove function as outlined below. This is the most basic example I can give. class SomeState extends State { constructor(game){ //does some stuff with the passed in game } enter(){ //attach some animation loops to the app ticker this.game.app.ticker.add(this.game.someAwesomeFunction.bind(this.game)); } //...a bunch of things to do with updating a state etc exit(){ //Here I would like to essentially pause a subset of the animation loops attached in the enter //function like so: this.game.app.ticker.remove(this.game.someAwesomeFunction); //This doesn't behave as expected sadly, the function is not removed from the ticker and just //continues on like nothing happened } } I have observed the function signature being passed to `remove` and it matches the signature being passed to `add`. Has anyone got any ideas as to why I am unable to remove a listener instance from the game ticker? Or in fact have an opinion on this approach in general, may I am barking up the wrong tree. Thank you in advance!