Search the Community
Showing results for tags 'windows store app'.
-
Hi Everyone, I'm experimenting with phaser and js windows store apps. I created a very simple app, just moving some sprites on the screen. What troubles me is quite often when i run the app on local machine from visual studio it lags. The sprites gently jump rather than move smoothly. This happens randomly. One time everything works smooth, next time it lags again (without changing the code or starting any other applications or anything). I use game.debug.text to draw fps to the screen and every time the game laggs i have 67 or 65 or 63. When game runs smoothly fps is equals 60. The extra few fps that happen in corelation with the laggy behavior happen even if i use game.time.deltaCap = 1 / 60. Has anyone came accross something similar ? Any help appreciated . Thanks! Code: // For an introduction to the Blank template, see the following documentation: // http://go.microsoft.com/fwlink/?LinkID=392286 (function () { "use strict"; var app = WinJS.Application; var activation = Windows.ApplicationModel.Activation; // init for phaser; var game; var fishgroup; function preload() { //prealoaing assets game.load.image('xxx', 'images/test.png'); } function create() { game.time.advancedTiming = true; game.physics.startSystem(Phaser.Physics.ARCADE); fishgroup = game.add.group(); //game.stage.backgroundColor = '#ffffff'; game.time.advancedTiming = true; // game.time.deltaCap = 1 / 60; for (var i = 0; i < 5; i++) { var f = fishgroup.create(game.world.randomY, game.world.randomY, 'xxx'); game.physics.enable(f, Phaser.Physics.ARCADE); f.scale.setTo(2, 2); f.body.velocity.setTo(300, 0); } } function update() { for (var i = 0; i < fishgroup.length; i++) { var f = fishgroup.getAt(i); if (f.body.x > game.world.width) { f.reset(0 - f.body.width, f.body.y) //f.body.x = (0 - f.body.width); f.body.velocity.setTo(300, 0); } else if (f.body.x < 0 - f.body.width) { f.reset(game.world.width, f.body.y) // f.body.x = game.world.width; f.body.velocitysetTo(300, 0); } } } function render() { game.debug.text(game.time.fps + "---" + game.time.deltaCap + "---" + game.time.fpsMax, 100, 100); } app.onactivated = function (args) { if (args.detail.kind === activation.ActivationKind.launch) { if (args.detail.previousExecutionState !== activation.ApplicationExecutionState.terminated) { // TODO: This application has been newly launched. Initialize // your application here. game = new Phaser.Game(1600,900, Phaser.CANVAS, '',{ preload: preload, create: create, update: update, render: render}); } else { // TODO: This application has been reactivated from suspension. // Restore application state here. // load , unpause } args.setPromise(WinJS.UI.processAll()); } }; app.oncheckpoint = function (args) { // TODO: This application is about to be suspended. Save any state // that needs to persist across suspensions here. You might use the // WinJS.Application.sessionState object, which is automatically // saved and restored across suspension. If you need to complete an // asynchronous operation before your application is suspended, call // args.setPromise(). }; app.start(); })();
- 1 reply
-
- windows 8.1
- windows store app
-
(and 3 more)
Tagged with: