Jump to content

Performance Issues with 2 Background Images.


totenkreuz
 Share

Recommended Posts

Hi so, I'm trying to make a FlappyBird game with Day/Night Cycle so to do this I have 2 Background images set up on my game; one morning and another one for evening.

I understand that I can just use loadTexture on this.background, but I want to Tween it for a better effect (hence the 2 background images).

The animation that I wanted was to Tween this.nextBackground's opacity from 0 to 1.

 

In my create function I have the following:

this.game.physics.startSystem(Phaser.Physics.ARCADE);

this.background = this.game.add.sprite(0, 0, 'morning');

this.nextBackground = this.game.add.sprite(0, 0, 'evening');

 

If it helps, I have a pipeGenerator timer that generates the pipes.

this.pipeGenerator = this.game.time.events.loop(Phaser.Timer.SECOND * 1.25, this.generatePipes, this);

and I'm planning to implement a dayNightCycler timer that changes from morning to night and vice versa by tweening.

But as is, I'm already having poor performance while just adding the nextBackground.

 

I noticed that whenever I create this.nextBackground, I am having poor performance issues, anyway I can make this work? Sorry was new to Phaser.

Link to comment
Share on other sites

23 hours ago, 3ddy said:

I'm not sure if it does matter or not, but what size is your game and what size are your background images?

I tried setting mode to CANVAS and it works perfectly now. It seems also that when testing on Simulator, I receive massive framerate drop, testing it on an actual device works good! Thanks.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...