Decadent Posted December 3, 2014 Share Posted December 3, 2014 Hi, I'm still new to panda js. I got a question that am I able to use addTimer in Class (not scene). Even I did: game.scene.addObject(this); addTimer is still not work in Class. Can anyone help me figure this out? Thanks Quote Link to comment Share on other sites More sharing options...
enpu Posted December 3, 2014 Share Posted December 3, 2014 What exactly are you trying to do? You can use addTimer inside Class like this:game.createClass('MyClass', { init: function() { game.scene.addTimer(1000, this.complete.bind(this)); }, complete: function() { // Timer complete }}); Quote Link to comment Share on other sites More sharing options...
Decadent Posted December 4, 2014 Author Share Posted December 4, 2014 What exactly are you trying to do? You can use addTimer inside Class like this:game.createClass('MyClass', { init: function() { game.scene.addTimer(1000, this.complete.bind(this)); }, complete: function() { // Timer complete }}); Great I find the problem!Thank you for your example. I used:this.addTimer(500, call_function.bind(this));instead, I should use game.scene.** 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.