CharlesCraft50 Posted January 16, 2017 Share Posted January 16, 2017 I'm facing some kind of issues, when the player moving or in the air or falling in the air, the game will lag in mobile (not on desktop) Code: if(cursors.left) { player.body.velocity.x = -200; if(player.facing != 'left') { player.scale.x = 1; player.animations.play('walk'); player.facing = 'left'; } } else if(cursors.right) { player.body.velocity.x = 200; if(player.facing != 'right') { player.scale.x = -1; player.animations.play('walk'); player.facing = 'right'; } } else { player.body.velocity.x = 0; if(player.facing != 'idle') { player.animations.stop(); if(player.facing == 'left') { if(player.holding != 'nothing' && player.holding != 'powerUp_2x') { player.scale.x = 1; player.animations.stop(); player.frame = 10; } else { //Jump animation: if(this.jumping == true) { player.frame = 13; player.scale.x = 1; //break; } else { //Player idle left player.scale.x = 1; player.animations.stop(null, true); //break; } } } else { if(player.holding != 'nothing' && player.holding != 'powerUp_2x') { player.scale.x = -1; player.animations.stop(); player.frame = 10; } else { //Jump animation: if(this.jumping == true) { player.frame = 13; player.scale.x = -1; //break; } else { //Player idle left player.scale.x = -1; player.animations.stop(null, true); //break; } } } player.facing = player.facing; } } if(player.body.onFloor()) { this.jumps = 0; this.jumping = false; } if(cursors.up && this.jumps < 5) { player.body.velocity.y = -1000; this.jumps++; this.jumping = true; } if(cursors.down) { if(player.facing == 'left') { player.scale.x = 1; } else { player.scale.x = -1; } player.frame = 4; player.body.velocity.x = 0; } Link to comment Share on other sites More sharing options...
b10b Posted January 16, 2017 Share Posted January 16, 2017 There doesn't appear to be any code posted above relating to Intel XDK or Cordova etc - why do you think the issue is XDK related? How does the same game play in-browser on the same mobile device? Perhaps the issue you are facing is non-apparent on desktop due to increased performance - for example update loops using a deltaTime, which is very small on the more powerful desktop, but larger on the less performant mobile to the extent of observable lag. But I am speculating. To avoid guesswork add runtime debug output for you to measure what's really happening on any give device - add functionality incrementally and zoom into any area that effects performance. Link to comment Share on other sites More sharing options...
CharlesCraft50 Posted January 17, 2017 Author Share Posted January 17, 2017 @b10bI already saw the problem, the problem is in tilemap so I added this code and the lags reduced a little bit: map_tiles_1.renderSettings.enableScrollDelta = true; map_tiles_2.renderSettings.enableScrollDelta = true; map_tiles_3.renderSettings.enableScrollDelta = true; Link to comment Share on other sites More sharing options...
b10b Posted January 17, 2017 Share Posted January 17, 2017 i.e. not an Intel XDK issue. It's important to be precise to avoid future confusion and inaccurate negative association with such a topic title Link to comment Share on other sites More sharing options...
Recommended Posts