• Content count

  • Joined

  • Last visited

  1. I noticed that sprite.x/y doesn't have any effect on player coordinates in Phaser CE v2.7.10. However, sprite.body.x/y works perfectly. What is sprite.x/y for?
  2. I'm trying to scale a tilemap using TilemapLayer.setScale but it blurs tiles, is there any way to scale tilemap with full quality? Phaser's scaling: https://prnt.sc/fsgcfz Tiled zoom: https://prnt.sc/fsgcp3
  3. How can i find the last active pointer? I'm looking for something like this: game.input.onDown.add(oninputdown, this); function oninputdown(pointer){ lastPointer = pointer; }
  4. No, all images in the images/ dir.
  5. Game.js: setTimeout(function(){ this.state.start('MainMenu'); }.bind(this), 1500); MainMenu.js (triggered on click): this.state.start('Game'); Edit: Physics is also started on Game state if i start physics on MainMenu. Is this normal?
  6. I get this error when restarting Game state. This line causing the error: this.player.healthbar = new HealthBar(this, {x:this.player.x, y:this.player.y-25, height:5, width:50}); It's all fine if i call world.removeAll in the state.shutdown function. shutdown: function(){ this.world.removeAll(); } Why am i have to call world.removeAll after switching states? Shouldn't it clear the game world itself when game.state.start is called? Docs says "but not the Stage, so if you've added your own objects to the Stage they will need managing directly" Is healthbar added to the Stage? If so, What is the stage? I'm using phaser.healthbar plugin to create health bars.
  7. For desktop devices, there's no bounds even without _definedSize. (for scaleMode SHOW_ALL) For mobile devices, there's world bounds set to screen size. this.world._definedSize = true; this.stage.disableVisibilityChange = true; this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; It doesn't let me replace world bounds with Box2D's setBounds method, only world.setBounds. I need to have world bounds with Box2D bodies. this.physics.box2d.setBoundsToWorld(); // or this.physics.box2d.setBounds(0, 0, 19200, 19200); // same as box2d.setBoundsToWorld() since it doesn't use x,y,width,height. // No effect
  8. What's the difference between this.scale.scaleMode = Phaser.ScaleManager.RESIZE; this.scale.pageAlignHorizontally = true; this.scale.pageAlignVertically = true; and this.scale.setResizeCallback(function(obj,rect){ this.scale.setGameSize(rect.width, rect.height); }, this); I need to use Box2D's world bounds but scaleMode RESIZE sets it's own bounds to the world and i can't replace it. With setResizeCallback everything works fine (i think, at least.) Can I use Box2D's world bounds with scaleMode RESIZE if there's a big difference?
  9. I want to put my game to Play Store, I googled it a bit and found Cordova and CocoonJS. I'm planning to use Box2D plugin and websockets for the game so my questions are: Which one is faster? I don't want to use CocoonJS if i don't have to since it adds a "built with Cocoon" splash. Is websockets supported? Is it possible to read & write files, show notifications? Can I use Google Play Games Services? How can I monetize my game? Is there an easy way to add ads? Thanks.
  10. I need to change x,y coordinates of texts, sprites etc. when screen size changes. I made something like this, but i don't think this is the right solution. How can i do this directly with Phaser? document.getElementsByTagName("body")[0].onresize = function(){ var w = window.innerWidth * window.devicePixelRatio; var h = window.innerHeight * window.devicePixelRatio; // Game size if(w != game.width || h != game.height) { game.scale.setGameSize(w, h); } // UI HPText.cameraOffset.y = h-245; Text1.cameraOffset.y = h-325; Text2.cameraOffset.y = h-305; Text3.cameraOffset.y = h-285; Text4.cameraOffset.y = h-265; } Is it possible to scale sprites/texts for all devices? If so, how? I couldn't find an easy solution for that. Also, what does game.scale.setShowAll() do? Can't find this function in the docs.
  11. Works well if you minus x,y by the size of player's rectangle. Use final solution instead, this doesn't work correctly. this.mmgraphics.drawRect(player.x/this.mmgraphics.timesby+this.mmgraphics.padding-10,this.camera.height+player.y/this.mmgraphics.timesby-this.mmgraphics.padding-this.mmgraphics.screensizeH-10,10,10); Edit: Final solution Just minus screensize values by rectangle size. // create this.mmgraphics.timesby = (((this.mmgraphics.mapWidth/(this.mmgraphics.screensizeW-5))/2)+((this.mmgraphics.mapHeight/(this.mmgraphics.screensizeH-5))/2)); // update this.mmgraphics.drawRect(((entity.x/this.mmgraphics.timesby)+this.mmgraphics.padding),(this.camera.height+(entity.y/this.mmgraphics.timesby)-this.mmgraphics.padding-this.mmgraphics.screensizeH),5,5); You can change timesby on update function to have rectangles in different sizes.
  12. I actually tried that before, didn't work tho.
  13. I fixed it by increasing mmgraphics.mapWidth and mmgraphics.mapHeight values by 1000. It's perfectly fit now. Edit: I only changed mapWidth. There's no problem with mapHeight, weird.
  14. Still the same, idk why.
  15. Still having the same problem :/ this.mmgraphics.drawRect((player.x-5)/this.mmgraphics.timesby+this.mmgraphics.padding,this.camera.height+(player.y-5)/this.mmgraphics.timesby-this.mmgraphics.padding-this.mmgraphics.screensizeH,10,10); Am I doing something wrong?