Nikow

V2.3.0 - Phaser error in Safari..

Recommended Posts

Hi, I've to finish a game this week, and i test it today, it's working very well on chrome and firefox, but not in safari, i ve the first screen of the game, but right after clicking 'play' button, i fall on a black screen with this error on my js console :

[Error] TypeMismatchError: DOM Exception 17: The type of an object was incompatible with the expected type of the parameter associated to the object.createPattern (phaser2.3.0.min.js, line 6)_renderCanvas (phaser2.3.0.min.js, line 6)_renderCanvas (phaser2.3.0.min.js, line 3)_renderCanvas (phaser2.3.0.min.js, line 3)renderDisplayObject (phaser2.3.0.min.js, line 5)render (phaser2.3.0.min.js, line 5)updateRender (phaser2.3.0.min.js, line 9)update (phaser2.3.0.min.js, line 9)updateRAF (phaser2.3.0.min.js, line 14)_onLoop (phaser2.3.0.min.js, line 14)

Share this post


Link to post
Share on other sites

Thank you Rich,

 

Creations :

bgCity3 = game.add.tileSprite(0,0,3000,640,'decorsBG3');game.physics.arcade.enable(bgCity3);bgCity2 = game.add.tileSprite(0,0,3000,640,'decorsBG2');game.physics.arcade.enable(bgCity2);bgCity1 = game.add.tileSprite(0,0,3000,640,'decorsBG1');game.physics.arcade.enable(bgCity1);

And :

bgCity1.tilePosition.x -=  speed/10;
bgCity2.tilePosition.x -=  speed/20;
bgCity3.tilePosition.x -=  speed/30;

In Render function..

 

It's working perfectly on others browsers...

Share this post


Link to post
Share on other sites

The width is huge - that's a width of 3000 pixels, so it will literally try to create a texture that is 3000 pixels wide. You really don't want this, what you need is to create the TileSprite no larger than the game width, and then use tilePosition.x to scroll it.

 

Also what size is the png you're using? (dimensions, not file size).

Share this post


Link to post
Share on other sites

 

Perhaps try to apply Math.floor()

bgCity1.tilePosition.x -= Math.floor(speed/10);

bgCity2.tilePosition.x -=  Math.floor(speed/20);
bgCity3.tilePosition.x -=  Math.floor(speed/30);

 

It's not ok :/ 

Share this post


Link to post
Share on other sites

The width is huge - that's a width of 3000 pixels, so it will literally try to create a texture that is 3000 pixels wide. You really don't want this, what you need is to create the TileSprite no larger than the game width, and then use tilePosition.x to scroll it.

 

Also what size is the png you're using? (dimensions, not file size).

It's 3000px png, i create tilesprite at the same size than the png.

My scrolling bg width is 3000px ..

Share this post


Link to post
Share on other sites

Thank you Rich,

 

Creations :

bgCity3 = game.add.tileSprite(0,0,3000,640,'decorsBG3');game.physics.arcade.enable(bgCity3);bgCity2 = game.add.tileSprite(0,0,3000,640,'decorsBG2');game.physics.arcade.enable(bgCity2);bgCity1 = game.add.tileSprite(0,0,3000,640,'decorsBG1');game.physics.arcade.enable(bgCity1);

And :

bgCity1.tilePosition.x -=  speed/10;
bgCity2.tilePosition.x -=  speed/20;
bgCity3.tilePosition.x -=  speed/30;

In Render function..

 

It's working perfectly on others browsers...

 

If i delete these lines, it's work on safari ( but very poor performance)..

 

Any ideas ?

Share this post


Link to post
Share on other sites

As an experiment try this - resize the texture to be 1024 wide and try it in Safari again.

 

I resize it, but it's already not working on safari, need your help ^^?

Share this post


Link to post
Share on other sites

I Rich, Same prob on safari with 960x640 images ?

 

Need help please..

 

for everyboy, do never create tilesprites on two differents states with same name....

It's solved all my probs...

 

Thanks all !

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.