PunyOne

Members
  • Content Count

    7
  • Joined

  • Last visited

About PunyOne

  • Rank
    Newbie

Contact Methods

  • Twitter
    PunyOne
  1. Thanks, that solved it! Previously I was using "Panda.js node toolkit v1.3.5", installed on 25.5.2014.
  2. That is exactly what I have in the code (you can check it on the page, the canvasId is "1968_canvas"). I can see that it is in the canvas because it moves the frame of the canvas too (I used blue frame in the debug and I clearly saw that the frame got moved to the topleft corner).
  3. Thanks for reply but it does not help - when I set the above, it puts the canvas to the topleft corner of the whole page, so it lies over the buttons and others. I tried all the combinations of the System parameters I could find, without success.
  4. So I finished a game that originated at a Jam with the topic "Russian Invasion". You can play it here: http://www.justaconcept.org/Games/1968/index.html . A tiny screenshot: With that I have a little question, I tried to position the game inside my page as you can see, but I had trouble that PandaJS takes the canvas it is put in and places it to it's own preferred coordinates. I achieved the above effect by explicitly removing the absolute positioning from the engine source, but that's quite a hack. Basically what I need is for panda to position the canvas w.r.t. its parent (e.g. a <div>) instead of the whole window. Any suggestions?
  5. Following on the previous - I found that the timers keep running after the change of scene, meaning that: game.module('game.main') .body(function() { SceneGame = game.Scene.extend({ init: function() { this.addTimer(1000, this.my_timer, true); game.system.setScene(End); }, my_timer: function() { console.log('second'); this; } }); game.start(); End = game.Scene.extend({ init: function() {} }); });will still call the timer every second, even though the scene have changed (and will crash if I put breakpoint in the timer). I figured that I can just set this.timers = []; before the scene change, however that does not feel nice. Any suggested approach?
  6. Thank you! I Googled a bit based on your reference and now I also understand that I was passing a result of calling 'my_timer()' rather than the function itself. For the completeness, this would also work, but 'SceneGame' would not be accessible from within of 'my_timer': game.module('game.main') .body(function() { SceneGame = game.Scene.extend({ init: function() { this.addTimer(1000, this.my_timer, true); }, my_timer: function() { console.log('second'); } }); game.start(); });
  7. I have problem with timer - I want a repeated execution of a function, which works if the function is lambda, but not if the function has a name. For illustration, this code writes the console every second: game.module('game.main') .body(function() { SceneGame = game.Scene.extend({ init: function() { this.addTimer(1000, function() { console.log('second'); }, true); } }); game.start(); });This code writes the console exactly once, after a second: game.module('game.main') .body(function() { SceneGame = game.Scene.extend({ init: function() { this.addTimer(1000, this.my_timer(), true); }, my_timer: function() { console.log('second'); } }); game.start(); });In my understanding they should be equal, but I have subpar knowledge of JS, so maybe it's some scoping thing?