afcruzs

Members
  • Content Count

    13
  • Joined

  • Last visited

About afcruzs

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Have you seen this?: http://phaser.io/docs/2.4.7/Phaser.SoundManager.html There seems to be issues with the iPad: "Mobile warning: There are some mobile devices (certain iPad 2 and iPad Mini revisions) that cannot play 48000 Hz audio. When they try to play the audio becomes extremely distorted and buzzes, eventually crashing the sound system. The solution is to use a lower encoding rate such as 44100 Hz. Sometimes the audio context will be created with a sampleRate of 48000. If this happens and audio distorts you should re-create the context."
  2. Hi Samme, thanks that seems like a good start. I have played with it but there seems to be a very weird behavior: If I do zoom in the boundary on which I can move moves as well, for an instance, if the max x value I can get is 500, and then I add 0.1 to the camera.scale then the max value increases to 700 or something like that. Do you know what can be the cause?, and, how does mask work?, is that from PixiJS?, so that we can understand what is going on. I modified your pen to reproduce what I am talking about. I added a keypress on the enter key, so the game.camera.scale is increased.
  3. I added the mask this way: mask = game.add.graphics(0, 0) .beginFill(0xffffff) .drawRect(0, 0, 320, 320) .endFill(); this.game.world.mask = mask; But it behaves exactly as if I apply it to an sprite. I still do not fully understand how the mask works, but I think that the mask dimension and position is affected by the world camera. I will check how does it work with this: https://github.com/Flaxis/slick-ui.
  4. I set the mask to a group with the background sprite. How would it be to mask the whole game.world?
  5. Thanks Samme. Altough as I am implementing the drag and specially the zoom using the world camera whenever I increase the scale of the camera, the mask size also increases... I have been thinking about leaving the viewport as the Phaser Game and manage the UI through HTML / CSS outside Phaser. What do you think?, I would prefer a solution with only Phaser, but I think so far it only complicates more my current code. Thanks!
  6. I am trying to implement a zoom/drag functionality with some menus over the map. Think of Age o Empires 3, you basically have a map on which you can do zoom and drag, but you also have som menus that are always over the screen. Check this for clarity. So far. I have implemented the zoom/drag by modyfing the x, y and scale attributes of game.scale. But this work pretty good when the scale is big enough to cover the whole screen. But what I need is some kind of viewport that is smaller than the screen (like in Age of Empires) where all the zoom/drag works. The remaining parts of the screen that are not part of the viewport are filled by the UI menus. So far I have put the menus outside the world like I posted here. I attached an image with what I mean by viewport and menus in case is not clear Thanks :)!
  7. Thank you UncleAcid, that's exactly what I was looking for.
  8. Hi, currently I am doing an animation for the appearence of an sprite. That requires to modify the scale of the sprite and its coordinates at the same time. But with the current tween API it seems like only one field can be modified at once. I've researched a bit and I came up with this: var tween = this.game.add.tween(sprite.scale). to( { x: prevWidth * 1.5, y : prevHeigth * 1.5 }, 200, "Linear", false ). to( { x: prevWidth, y : prevHeigth }, 200, "Linear", false ); var tween2 = this.game.add.tween(sprite). to( { x : scX , y : scY }, 200, "Linear", false ). to( { x : orX, y : orY }, 200, "Linear", false ); tween.start(); tween2.start(); It works reasonable, but both tweens run concurrently, which I think it maybe a problem with more complex animations. Is there a better way to do this and avoid concurrency issues? Thanks.
  9. I finally found a way!. As mentioned here the Stage is "above" of the World. So placing an element there won't be affected by the world dynamics (in my case, the camera). So what I did was to add a group in the stage and then add the sprites to that group. As simple as that. The code: var buttonsGroup = this.game.add.group(null, "buttonsGroup", true); var theSprite = buttonsGroup.create( x, y, "spriteName" ); The arguments of the group method are described here, the first is the parent and the last is a boolean value to indicate if the group should be added to the stage. I hope it will be useful to anyone
  10. Hi, I implemented a two finger zoom using the game.camera.scale propierty to zoom the game. I also implemented a drag functionality using game.camera.x and game.camera.y propierties. But now I need to add static floating sprites, such that they are always in the same position on the screen regardless the zoom or the drag movement. But when I add them as sprites (game.add.sprite) they are affected by the camera propierties (x,y,scale). I read this and set fixedToCamera to true, it works partially, the (x,y) is static, but the when I zoom in (increase game.camera.scale) the size of the floating sprites also increases. Is there any way I could add sprites that are not dependent on the camera? Thanks!
  11. Thanks for your answer samme In the docs (https://phaser.io/docs/2.6.2/Phaser.Sprite.html#checkWorldBounds) says that checkWorldBounds calculates the bounds every time and that it can be a expensive operation. Is it worst to use inCamera withouth having set checkWorldBounds to true?. Using intersectsRaw has linear time cost with respect to the size of camera.view. I am not sure, but it seems like the 3 approaches end up doing calculations in linear time (maybe checkWorldBounds is faster?). I think that using a quadtree or a structure like that can make this operation much faster, but I don't know if the current API has something like that, of if that is even possible anyway.
  12. Is there any way to add a listener that triggers when a sprite is visible by the camera?. The object Sprite contains inCamera, but it seems to re compute the bounds of the sprite according to this: http://www.html5gamedevs.com/topic/8936-does-phaser-handle-object-visibility-according-to-camera/, and that can be expensive. In my case I need to do this for many sprites on the screen, so I want to know if there is a more efficient way to do it.