Ninjadoodle Posted September 9, 2014 Share Posted September 9, 2014 Hi guys When I set up a timer as per the Panda screencast, it doesn't seem to work. I get no printout in the console game.createScene('Level1', { backgroundColor: 0xFFFFFF, init: function() { this.addTimer(100, function() { console.log("Testing"); }); }}); Thanks i advance for any ideas! Quote Link to comment Share on other sites More sharing options...
enpu Posted September 9, 2014 Share Posted September 9, 2014 Weird, that code works for me. Can you show your full code? Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 9, 2014 Author Share Posted September 9, 2014 Hi @enpu Thanks for the reply! The code works if I try to run it inside ... game.createScene('Main', { but after changing scenes ... game.system.setScene('Level1'); the timer won't work inside the new scene. Everything else works ok ...classestweensloading assets etc. this is the code inside my main.js game.module( 'game.main').require( 'game.level01', 'game.objects', 'game.assets').body(function() {game.addAsset('logo.png');game.createScene('Main', { backgroundColor: 0xb9bec7, init: function() {game.system.setScene('level01'); }});}); and this is the level01.js game.module( 'game.level01').body(function() {// LEVEL CODEgame.createScene('level01', { backgroundColor: 0xFFFFFF, init: function() { this.addTimer(100, function() { console.log("Testing"); }); }});});Thank you in advance for any ideas Quote Link to comment Share on other sites More sharing options...
enpu Posted September 11, 2014 Share Posted September 11, 2014 You should not change scene right on scene's init function. Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 12, 2014 Author Share Posted September 12, 2014 Hi @enpu Thanks heaps for your help! It works as it should now 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.