kmp

Members
  • Content Count

    7
  • Joined

  • Last visited

  1. As this issue is being actively addressed and should be fixed in the next release, I am marking the thread solved. Many many thanks to the developers. You do a superb job.
  2. Hi - I've just upgraded my game to Phaser 2.2.1 and my game no longer works as a Google Chrome App. The game loads and runs OK if I just run it as a web page in Google Chrome but it cannot be installed as a Google Chrome App because it breaks the more stringent security standards for Chrome Apps. Google Chrome Apps cannot use eval or new Function(). The latest Phaser uses new Function() and this prevents it being used as a Chrome App. The offending code is: // `new Function(string)` is ugly but it avoids closures and by-string property lookups. // Since this is a [near] micro-optimization anyway, might as well go all the way. /*jslint evil: true */ // The accessor creates a new Signal (and so it should only be used from user-code.) Object.defineProperty(Phaser.Events.prototype, prop, { get: new Function("return "+backing+" || ("+backing+" = new Phaser.Signal())") }); // The dispatcher will only broadcast on an already-defined signal. Phaser.Events.prototype[dispatch] = new Function("return "+backing+" ? "+backing+".dispatch.apply("+backing+", arguments) : null"); I'm not sure how to raise a bug report but this should be fixed.
  3. Hi - I've just written my first android game using the accelerometer. But it does not work. To be precise the callbacks in the following statement never get executed: this.watchID = navigator.accelerometer.watchAcceleration(this.onSuccess, this.onFailure, options); I can trace the code into this statement and the statement executes without error, returning a valid watchID. However, the onSuccess and onFailure methods never get called. It's like my phone has no accelerometer or the accelerometer has been disabled. I am using the cordova command-line tools. I thought this was something to do with my code, so I created a new cordova project and used the example accelerometer code. What I found was that in the emulator the callback for onFailure was called. I presume this is correct as the emulator has no accelerometer. However, when I transferred the example app to my phone, no callback - success or failure - was ever called. So I don't think my code is at fault. Perhaps it is something to do with my phone. It is a Nexus 4 and has just been upgraded to the latest Android (lollipop). The API level of the game is 19. Do I have to do something to enable the accelerometer on my phone? There must be something major I'm missing since I get something from the emulator but nothing from the actual phone. Thanks in advance for any help. Ken
  4. kmp

    Cleaning up on Game over

    Great. That's just what I wanted to hear
  5. Thanks to everyone for their replies. Looks like 2.2 will help with this issue. I'll look forward to it. As a matter of interest, my android phone (Nexus 4) was giving about the same frame rate as my desktop (60 fps) - only the Kindle Fire was appreciably slower (35 fps). Ken
  6. I have a game where all the movement is run by ARCADE physics. When I run the game on my desktop it runs faster than it does on my Android phone and my Kindle Fire. I would like the game to run at the same speed on all devices but, as movement is controlled by the physics engine, I cannot directly adjust sprite movement. Does anyone have a good technique for this? Ths only thing I can think of is to set an ideal rate (60 fps) - the speed on Firefox on my desktop - and change all the physics engine values in proportion to how the device matches this speed, like this: this.game.physics.arcade.gravity.y = 200 * (idealfps / actualfps); So on a desktop runing at 60fps the gravity setting would be 200 * (60/60) = 200. On a slow dvice with only 30 fps then the gravity would be 200 * (60/30) = 400 So sprites woudl fall at the same rate as on the faster machine. Is this the best way to go about it? Thanks in advance Ken
  7. This is a simple question: when you switch from one game state to another are you supposed to clean up - stop timers, destroy sprites etcetera? I'm writing my first phaser game. I have a game state and a game over state. Obviously I switch from the game state to the game over state when the game is over and from game over I switch back to the game state if the user wants to play again. Just switching like this seems to work perfectly: if (this.sprite.y < 0) { this.game.state.start('GameOver'); } But the game state has timers and sprites - should I destroy them before switching? Am I worried about nothing? Does Phaser do the necessary tidying up? Thanks in advance Ken