peterje Posted June 9, 2021 Share Posted June 9, 2021 Hi devs, In my project I have a number of GameObjects, each of which have a sprite attribute which is a derivative class of Pixi.Sprite. That doesn't really matter but just some background. Here's the issue: public startGame(): void { this.running = true this.app.ticker.start() for (const go of this.gameObjects) { go.sprite.dragDisable(); go.sprite.start() this.app.ticker.add(go.sprite.update, go.sprite) // this is the problem } } It is important that I can pass in go.sprite in as a context! Each of my sprites have an update method, but it takes in a delta parameter: update(delta: number): void; So how can I add these callbacks to my ticker but pass in delta time? Thanks Peter Quote Link to comment Share on other sites More sharing options...
Exca Posted June 9, 2021 Share Posted June 9, 2021 (edited) It looks correct. Doesn't the delta get passed or what is the issue? You are adding a function that has delta parameter to ticker with the context of the sprite so it should work. Edited June 9, 2021 by Exca Fixed typo Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.