Chefo

chrome showing blending but no firefox

Recommended Posts

Hello,

I'm using Phaser CE trying to make a very simple game were two cowboys shoot them but in the middle there is a Cactus which gets destroyed with every shot.

I followed this example https://phaser.io/tutorials/coding-tips-002 run nice  in every browser.

So I have almost everything working in chrome but in Firefox I cant see anything drawn over the BMP.

It's hard to simplify my original code. So I tried to build a very simple one to showcase my problem by extracting code from the example link. I just want to draw a whole when pressing key A.

I also tried with different blending modes. It still does run ok in chrome but not in FF nor safari.

Has it anything to do with my code or with the browsers...?

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
var background;
var landBMP;

function preload() {
    game.load.image('land','assets/images/land.png');
    game.load.image('background','assets/images/background.png');
}

function create() {

    boomKey =  game.input.keyboard.addKey(Phaser.Keyboard.A);
    boomKey.onDown.add(drawBoom, this);
    // Load Background
    background = this.add.sprite(0, 0, 'background');
    // Load bmp data
    landBMP = this.add.bitmapData(992, 480);
    landBMP.draw('land');
    landBMP.update();
    landBMP.addToWorld();

}

function drawBoom(){
    landBMP.blendDestinationOut();
    landBMP.circle(300, 400, 60, 'rgba(0, 0, 0, 255');
    landBMP.blendReset();
    landBMP.update();
}
function update() {
}

Any help is apreciated

PS: I attached my results with chrome and firefox after pressing A key

result with chrome.png

result with firefox.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.