Jump to content

Particle Emitter on Cocoon.js


freaker
 Share

Recommended Posts

Hi

 

I have a particle emitter that shows perfectly on my browser but when I put the game on the cocoon.js application it doesn't show. Neither it does on the webview render, so I'm wondering if there is any issue that makes the particle emitter to be deactivated/not showing on the ipad/mobile browsers... 

 

regards

 

Link to comment
Share on other sites

I've been investigating a little bit more, and it seems my problem is that the screen is not scaling properly and the emmiter is out of bounds... I'm using this scaling routine I found on the forums:

 

 game.stage.fullScreenScaleMode = Phaser.StageScaleMode.SHOW_ALL;
            game.stage.scale.setShowAll();
            game.stage.scale.pageAlignHorizontally = true;
            game.stage.scale.pageAlignVeritcally = true;
            game.stage.scale.refresh();
 
that I had to rewrite when Phaser.js updated to this:
 
        this.game.stage.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;
        this.game.scale.setShowAll();
        this.game.scale.pageAlignHorizontally = true;
        this.game.scale.pageAlignVeritcally = true;
        this.game.scale.refresh();
 
and it seems it's not working.... I'm a newbie, just starting with phaser.js. Finding what is wrong it might take me hours so if anybody with experience can take a look at how I resize the screen and tell me change this for that, I would be extremely thankful.
 
 
Link to comment
Share on other sites

Very sure you don't want to be doing this under Cocoon. I'd remove the page alignment and also you probably want a fixed canvas size that matches the device resolution. Have a look in the Cocoon JS thread in this board, I think there's some great suggestions in there.

Link to comment
Share on other sites

I've been investigating more in the issue I have with particle emmiters with Phaser 2.0 and Cocoon.js.

 

First this I found:

Particle emmiters are not working on CANVAS rendering mode. I tried with a Phaser.js example and they render on WEBGL but not in CANVAS

 

This is the code I'm testing (the diamond burst code)

 

var game = new Phaser.Game(800, 600, Phaser.WEBGL, 'phaser-example', { preload: preload, create: create });
var p;
function preload() {
    game.load.image('diamond', 'assets/sprites/diamond.png');
}
 
function create() {
    game.stage.backgroundColor = '#337799';
    p = game.add.emitter(game.world.centerX, 200, 200);
    p.makeParticles('diamond');
    p.start(false, 5000, 20);
}
 
If you choose to render into CANVAS, it shows nothing on COCOON.js, so it's not working
 
 
They work on WEBGL, but I can't use webgl at this moment as I have another problem with scaling that I can't solve and that I will write down on another post (WebGL doesn't scale as CANVAS does)
 
 
 
On the game I'm building (I'm just starting) there is a sprite moving on screen with no problem at all, and a particle emmiter attached to it (it's a group). Only the main sprite shows, and the particle emmiter doesn't. If I set it to CANVAS mode I can't see any particles at all.
 
Does anybody have a fix for this?
Link to comment
Share on other sites

@freaker: I commented on your other post too, but I'll write the same here: I'm going to look into this. There have been some reports of problems with Phaser 2.0 and CocoonJS that I'll be trying to figure out today.

 

However, something I'm curious about having read both posts now is which mode you are using for this testing. Are you using WebView or Accelerated mode in CocoonJS? There are separate issues for each and it could be something completely unrelated to CocoonJS if you are having problems while using the WebView mode.

 

Something else to remember is that, with Accelerated Mode, there isn't much of a DOM. In other words, you need to use an empty string for the parent element. Something like the following:

var game = new Phaser.Game(800, 600, Phaser.WEBGL, '', { preload: preload, create: create });

And, as I commented on the other topic, WebGL mode is broken in a number of ways in CocoonJS right now. There is a fix coming, but it will be when they release their next version.

 

 

 

Edit:

 

I just tried your (the example) Canvas code and got the same response. I'm going to move this to a known issue in just a few minutes.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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