Jump to content

gradients freezing game


Mike018
 Share

Recommended Posts

I have a gradient background in every state, which will eventually crash the game on mobile through X number of state switches. How do you properly re-use large bitmaps, because I tried to kill() the circle upon shutdown but I guess that just works on sprites.

 

        let bmd = this.game.make.bitmapData(this.game.width, this.game.height);

        bmd.addToWorld();

        let outerCircle = new Phaser.Circle(this.game.world.centerX, this.game.world.centerY, this.game.height);

        let grd = bmd.context.createRadialGradient(this.game.world.centerX, this.game.world.centerY, 0, outerCircle.x, outerCircle.y, outerCircle.radius / 1.4);
        grd.addColorStop(0, '#46435D'); // inner
        grd.addColorStop(1, '#252333'); // outer 

        bmd.cls();
        bmd.circle(outerCircle.x, outerCircle.y, outerCircle.radius, grd);

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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