Nikow Posted August 25, 2015 Share Posted August 25, 2015 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) Link to comment Share on other sites More sharing options...
rich Posted August 25, 2015 Share Posted August 25, 2015 The only part of Phaser that uses createPattern are TileSprites. Something about yours is tripping Safari up - find that bit of code (that creates it) and post it here, along with the texture it's trying to use. Link to comment Share on other sites More sharing options...
Nikow Posted August 25, 2015 Author Share Posted August 25, 2015 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... Link to comment Share on other sites More sharing options...
frenetikm Posted August 25, 2015 Share Posted August 25, 2015 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); Link to comment Share on other sites More sharing options...
rich Posted August 25, 2015 Share Posted August 25, 2015 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). Link to comment Share on other sites More sharing options...
Nikow Posted August 25, 2015 Author Share Posted August 25, 2015 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 :/ Link to comment Share on other sites More sharing options...
Nikow Posted August 25, 2015 Author Share Posted August 25, 2015 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 .. Link to comment Share on other sites More sharing options...
rich Posted August 25, 2015 Share Posted August 25, 2015 As an experiment try this - resize the texture to be 1024 wide and try it in Safari again. Link to comment Share on other sites More sharing options...
Nikow Posted August 25, 2015 Author Share Posted August 25, 2015 I try to create a tile of 960pc wide, but noting have change.. I will try to resize the texture :/ .... Link to comment Share on other sites More sharing options...
rich Posted August 25, 2015 Share Posted August 25, 2015 Use a power of two value, like 256, 512, 1024, etc. Link to comment Share on other sites More sharing options...
Nikow Posted August 25, 2015 Author Share Posted August 25, 2015 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 ? Link to comment Share on other sites More sharing options...
Nikow Posted August 27, 2015 Author Share Posted August 27, 2015 Up ? Link to comment Share on other sites More sharing options...
Nikow Posted August 27, 2015 Author Share Posted August 27, 2015 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 ^^? Link to comment Share on other sites More sharing options...
Nikow Posted August 27, 2015 Author Share Posted August 27, 2015 I activate 'WebGL' on safari and it's works now, so it's a prob with canvas render... Link to comment Share on other sites More sharing options...
rich Posted August 27, 2015 Share Posted August 27, 2015 I still think the problem is just the sheer size of the image. Link to comment Share on other sites More sharing options...
Nikow Posted August 27, 2015 Author Share Posted August 27, 2015 I still think the problem is just the sheer size of the image.Yes.. I think it's too now.... Very problematics for my projects... Link to comment Share on other sites More sharing options...
Nikow Posted August 28, 2015 Author Share Posted August 28, 2015 I still think the problem is just the sheer size of the image.I Rich, Same prob on safari with 960x640 images ? Need help please.. Link to comment Share on other sites More sharing options...
Nikow Posted August 28, 2015 Author Share Posted August 28, 2015 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 ! Link to comment Share on other sites More sharing options...
Recommended Posts