Jump to content

gradients freezing game


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);


        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.circle(outerCircle.x, outerCircle.y, outerCircle.radius, grd);


Link to comment
Share on other sites


  • Recently Browsing   0 members

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