brainbass

Members
  • Content Count

    6
  • Joined

  • Last visited

About brainbass

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. brainbass

    Firefox Slow FPS

    I have created an example with Phaser 3 and i have the same issue. http://cipa.ch/phaser3/ Perhaps you must be reload 2 or 3 times the page for the issue appear. i dont know why the FPS down 60 to 30. I have try to map a litle world 600x1200 but after times have the same issue. Have you an idea? Thank you for your help
  2. brainbass

    Firefox Slow FPS

    Thanks for your answer. Yes i have tried and too AUTO but nothing working. I use phaser.js 2.10.0 I try to create a game with world move. My code is: intro.js var game = new Phaser.Game(600, 600, Phaser.CANVAS, 'phaser-example'); game.state.add('boot',bootState); game.state.add('load',loadState); game.state.add('menu',menuState); game.state.add('game',gameState); game.state.start('boot') boot.js var bootState = { create: function(){ game.physics.startSystem(Phaser.Physics.ARCADE); game.state.start("load") } } load.js var loadState = { preload: function(){ game.load.tilemap('map', './racer.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('tileset', 'tiles.jpg'); game.load.image("road", "wall.jpg") game.load.spritesheet('car', 'caranime.png', 30, 30); game.load.image("borders", "black.jpg") game.load.image("cars", "dot.jpg") game.load.image("dog", "power.jpg") game.load.image("phare", "Phare.png") game.load.image("camion", "camion.jpg") game.load.image("oil", "oil.jpg") var loadingLabel = game.add.text(game.world.centerX, game.world.centerY, "Loading", { font: "bold 16px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }); loadingLabel.anchor.setTo(0.5, 0); }, create: function(){ game.state.start("menu") } } menu.js var menuState = { create: function(){ this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.game.scale.minWidth = 300; this.game.scale.minHeight = 300; this.game.scale.maxWidth = "600"; this.game.scale.maxHeight = "600"; this.game.scale.pageAlignHorizontally = true; this.game.scale.pageAlignVertically = true; var FirstLabel = game.add.text(game.world.centerX, game.world.centerY, "Press Space to start", {align:"center", font: "bold 16px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }); FirstLabel.anchor.setTo(0.5, 0); var kew = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); kew.onDown.addOnce(this.start,this); game.input.mouse.capture = true; game.input.onTap.add(this.start, this) },start: function(){ game.state.start("game") } } gamestate var gameState = { create: function(){ sensX = 30 sensY = 0; inGame = 0; levelTime = 120000; levelUp = levelTime; speed = 2; levelID = 1; stopCount = 0; this.safetile = 0; crash = 0; cursors = game.input.keyboard.createCursorKeys(); this.game.onPause.add(this.stopM, this); this.game.onResume.add(this.startM, this); this.spaceKey = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); loadingLabel = game.add.text(game.world.centerX, game.world.centerY, "You Lose", { font: "bold 16px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }); loadingLabel.anchor.setTo(0.5, 0); loadingLabel.alpha = 0; loadingLabel.fixedToCamera = true LoadLevel = game.add.text(game.world.centerX, game.world.centerY, "", { font: "bold 32px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }); LoadLevel.anchor.setTo(0.5, 0); LoadLevel.alpha = 0; LevelCountdown = game.add.text(300, 330, "", { font: "bold 32px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }); LevelCountdown.anchor.setTo(0.5, 0); LevelCountdown.alpha = 0; LevelTimer = game.add.text(300, 0, levelTime, { font: "bold 16px Arial", fill: "#fff", boundsAlignH: "center", boundsAlignV: "middle" }); LevelTimer.anchor.setTo(0.5, 0); LevelTimer.alpha = 0; LevelTimer.fixedToCamera = true Points = game.add.text(340, 0, "0", { font: "bold 16px Arial", fill: "#ffffff", boundsAlignH: "center", boundsAlignV: "middle" }); Points.anchor.setTo(0.5, 0); Points.alpha = 0; Points.fixedToCamera = true _this = this; _this.car = game.add.sprite(game.world.centerX,500, 'car'); _this.car.animations.add('mover',[0,1,2,3],30, true); _this.car.fixedToCamera = true; _this.car.alpha = 0 this.levelShow() },handleFpsProblem: function() { game.time.desiredFps = game.time.suggestedFps; },level: function(){ this.map = game.add.tilemap('map'); this.map.addTilesetImage('tileset'); this.layer = this.map.createLayer('Tile Layer 1'); this.layer.renderSettings.enableScrollDelta = false; this.map.setCollisionByExclusion([this.safetile], true, this.layer); game.physics.enable([this.car], Phaser.Physics.ARCADE); this.layer.resizeWorld(); game.camera.y = 18000 timerAccelerate = game.time.create(false); timerAccelerate.loop(10, this.levelAccelerate, this); timerAccelerate.start(); game.world.bringToTop(LevelTimer); game.world.bringToTop(Points); game.world.bringToTop(loadingLabel); this.car.alpha = 1 game.world.bringToTop(this.car); inGame = 1; },startM:function(){ stopCount = 0 },stopM:function(){ if(inGame == 1){ } stopCount = 1 },levelAccelerate: function(){ game.camera.y -= 2; },levelTimer: function(){ levelUp--; LevelTimer.setText(levelUp) if(levelUp == 0){ if(levelID == 2){ levelID++; }else if(levelID == 3){ levelID = 1; }else{ levelID++; } this.phare.alpha = 0 LevelTimer.alpha = 0 levelUp = levelTime; inGame = 0; timer.stop() timerLevel.stop() timerAccelerate.stop() this.levelShow() } },levelShow: function(){ LoadLevel.setText("Level "+levelID) var tt = game.add.tween(LoadLevel).to( { alpha: 1 }, 500, "Linear", true); tt.onComplete.add(this.countdown, this); },countdown: function(){ var count = 3; _this = this; timeToGo = setInterval(function(){ if(stopCount == 0){ LevelCountdown.setText(count) LevelCountdown.alpha = 1 if(count<0){ LevelCountdown.alpha = 0 //LoadLevel.alpha = 0; _this.level() clearInterval(timeToGo) } count--; } },1000) },direction: function(direct){ if(crash == 0){ switch (direct){ case "up": if(this.car.cameraOffset.y>0){ this.car.cameraOffset.y -= speed; } break; case "down": if(this.car.cameraOffset.y<570){ this.car.cameraOffset.y += speed + 1 } break; case "left": if(this.car.cameraOffset.x>0){ this.car.cameraOffset.x -= speed } break; case "right": if(this.car.cameraOffset.x<570){ this.car.cameraOffset.x += speed } break; } } },update: function() { if(inGame == 1){ if (cursors.up.isDown) { this.direction("up") } if (cursors.down.isDown) { this.direction("down") } if (cursors.left.isDown) { this.direction("left") } if (cursors.right.isDown) { this.direction("right") } } } } I don't know why is slowly. I have try with a old game i have created but is same problem. IE, Chrome, safari work fine but no firefox
  3. brainbass

    Firefox Slow FPS

    Hello, Since some day, firefox turn phaser game slow. All game i have created and even litle game downgrade fps. (60FPS to 30FPS) I dont know where is the problem. i have try use phaser but no change. You can try with this example : https://phaser.io/examples/v2/time/slow-down-time if you wait some seconds the animation down to 30fps. this problem is only on firefox (i suppose since v57). All others browsers working fine. Have you an idea where is the problem? Thank you
  4. brainbass

    Animation working when he want

    Thanks all. I have found my issue. The issue is because i have first initialized my car with : this.car = game.add.sprite(game.world.centerX,500, 'car'); this.car.animations.add('mover',[0,1,2,3],1000, true); this.car.fixedToCamera = true; _this = this After in my function i call directly my car with _this I used _this because inside setTimeout(), this property is no equal of this of document I dont know why but if i initialize first with this and after i call with _this this is not working fine. Also for resolve my issue i have starting with _this directly. _this = this; _this.car = game.add.sprite(game.world.centerX,500, 'car'); _this.car.animations.add('mover',[0,1,2,3],1000, true); _this.car.fixedToCamera = true;
  5. brainbass

    Animation working when he want

    Thank you for your reply. I have check _this.car and is a valid object. The console.log(_this.car) triggering but the animation sometimes not working. I initialize "_this" inside create() function _this = this;
  6. brainbass

    Animation working when he want

    Hi, I use phaser 2.6.1. I have created an animation. This work fine but sometimes this not starting. I dont know why. In create() function i add animations for my spritesheet: this.car = game.add.sprite(game.world.centerX,500, 'car'); this.car.animations.add('mover',[0,1,2,3],1000, true); this.car.fixedToCamera = true; When overlap i start the function for animate this game.physics.arcade.overlap(this.car, this.borders, this.canMove, null, this); This is my function },canMove: function(car, objet){ if(crash == 0){ crash = 1; _this.car.animations.play("mover"); console.log("fire") setTimeout(function(){ _this.car.animations.stop(); _this.car.frame = 0; crash = 0; },1000) } } When the car overlap a border, this function is start. The console.log() show but the animation suddenly not start. I can restart a lot of time my page, suddenly the animation not starting but the console.log() is show. Thanks for your help