Jump to content

Can't seem to get timers to work (SOLVED)


Ninjadoodle
 Share

Recommended Posts

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!


Link to comment
Share on other sites

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 ...
classes
tweens
loading 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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...