• Content Count

  • Joined

  • Last visited

Everything posted by Benjans

  1. Thank you so much xerver! We'll try it today. By the way the game I was talking about is online now: The "battle" part is made with Phaser, and we had problems with mobile version (we chose to deactivate some animations on mobile). Sorry, there are still pieces of french texts here and there, but we are correcting it
  2. Hi everyone, Thank you for your answers! We're still investigating about it, we found several minor fixes (deactivating sprites with transparency, reducing number of "text fields", etc...). @xerver would be awesome! When do you think we can check it?
  3. Hi everyone, I need your help to understand advanced behaviors in Phaser. We're developing a big game with Phaser, we have many sprites, many layers and many animations. We have texts, and transparency too. Everything we need to make the game slow and with poor FPS We want to optimize the game one step after another, and we want to understand, too, what is the most consuming task. The game is currently running at 40 to 50 FPS on a desktop, with some minor slowdowns, but that is ok for us. On a mobile phone, even with big hardware (iPhone 5s, Xperia Z1, HTC One M8), it runs at 2 to 10 FPS, unplayable. The strange thing is that we tried to run the game on the iOS simulator, to profil it, and the result was exactly the same as on mobile. In fact, on mobile and iOS simulator, the CPU usage is 120%. On desktop browser, the usage is 30%. We are totally sure that the problem is CPU usage because memory use and access are ok. Do you have any idea, why this happens? Why the same code runs great on desktop, and not on mobile browser, even in a simulator? Any help would be appreciated, cause we are lost Thank you guys!
  4. Hmm that's strange, because : I modified the script to add cameraOffset on the text, it works for the first text, but the second is not displayedOn sprites, it works without cameraOffset... And it's new, it did not work on 1.1.3My new code : var s1 = game.add.sprite(,, 'totoro'); s1.fixedToCamera = true; var s2 = game.add.sprite( + 100, + 100, 'totoro'); s2.fixedToCamera = true; // Add text var style = { font: "12px Arial", fill: "#ffffff" }; var t1 = game.add.text(10, 10, 'This is the first sentence', style); t1.cameraOffset(10, 10); t1.fixedToCamera = true; var t2 = game.add.text(100, 100, 'This is the second sentence', style); t2.cameraOffset(100, 100); t2.fixedToCamera = true;
  5. I found a small bug (trying to create the interfaces for my game), it was already here in the previous version. When you put several texts on the stage and try to fix it to camera, X and Y properties are not respected, and they are put on 0,0. You can check it here : This is my code : var style = { font: "12px Arial", fill: "#ffffff" };var t1 = game.add.text(10, 10, 'This is the first sentence', style);t1.fixedToCamera = true;var t2 = game.add.text(100, 100, 'This is the second sentence', style);t2.fixedToCamera = true;
  6. You're right and it works now, thank you. The strange thing is that informations (like tilesize) are now read in the tiled json file. Is there a way to specify it in the code?
  7. Hi, The 1.1.4 version solved many problems and improved my game, thank you so much (one more time) I just have a big problem to load tilemaps, maybe I'm doing it wrong (many people says that it's ok for them), but I can't see where. You can check an example here : It's very basic, and i've got this error : Phaser.Cache.getTilemapData: Invalid key: "0" No tiles are displayed (and according to the network pannel of my debug console, the JSON file and the tileset are not loaded)... Do you see what i'm doing wrong ? Thank you !
  8. Hey guys, thank you for your reply. I'll try to add more cars to see if it's still smooth... My game is based on Cookie Clicker mechanism: every second, a new inhabitant comes to your town. Update is called 60 times per second, the goal of the update function is to run as often as possible, not at a regular interval. That's why I used setInterval... Maybe I'm doing wrong?
  9. You don't see a small slowdown when we add a sprite? It's not very important currently, but the map is almost empty... I don't want the game to lag like death later
  10. Hi everyone, Just begining with Phaser, i love the phylosophy and how it works For my game, I'm drawing a big tilemap (100 x 100), adding static objects with no problems. Then I want to add moving objects, so I create a group and add sprites to the group, with a simple velocity. And... it doesn't work very well. It seems like each time a new sprite is attached to the group, the animation stops, then restart, so it's not smooth at all Maybe I'm doing something wrong, but I don't think so (i'm properly destroying objects). I tried with Tweens too, but the result is the same. You can check it here : Thank you for your help guys!
  11. Hi everyone, I'm trying to create a city builder with Phaser (i'm currently switching from Quintus to Phaser ). My map is displayed properly, and it is much bigger than the canvas. I want to make it dragable, so I tried many solutions, like this one : function create() { console.time('Create'); map = game.add.tilemap('world'); tileset = game.add.tileset('tiles'); layer = game.add.tilemapLayer(0, 0, viewportWidth, viewportHeight, tileset, map, 0); layer.resizeWorld(); // Input Enable the sprites layer.inputEnabled = true; // Allow dragging // enableDrag parameters = (lockCenter, bringToTop, pixelPerfect, alphaThreshold, boundsRect, boundsSprite) layer.input.enableDrag(true); /* var text = "Debug()"; var style = { font: "12px Arial", fill: "#ff0044", align: "center" }; var debug = game.add.text(0, 0, text, style); debug.input.onDown.addOnce(debug, this); */ console.timeEnd('Create'); }It does not work, I can not drag the map, nothing moves... Can you help me ?