Vizcur

Members
  • Content count

    7
  • Joined

  • Last visited

About Vizcur

  • Rank
    Newbie

Profile Information

  • Gender
    Not Telling
  1. Center text in container

    The one shown when using the function: game.debug.spriteBounds(myText);
  2. Center text in container

    Thanks samme but that doesn't solve the problem. For each font you use I would have to calculate how much the shift is and my idea was to be able to have phaser draw the texts centered in his container.
  3. Center text in container

    Hi, My query is this: I use the Cocos creator tool to position a text. When you export the position of this element and then integrate it into my phaser game, it happens that the selected position is slightly different from what is previewed in the Cocos tool. I suspect it is due to how both tools draw the font in their respective container. As you can see in the attached images, in the tool the text is centered in its container, however, in Phaser, when debugging the edges of the text, you can see that the font is positioned upwards. In short, both containers are in the same position but the texts are drawn in different positions. Is there any way to modify how Phaser draws the text in his container? As additional information, both texts are centered and added to a sprite as a child. The way the text is positioned varies according to the font used. Cocos tool Phaser:
  4. weightedPick random function

    I found this function really useful except for picking the last element, which is really really hard in comparison with the other elements, because only the number '1' in a random selection between 0 and 1 with double precision floating points can give the last element. Therefore, the probability of obtaining the last element is too low to be useful. var test = [0,1,2,3,4,5,6,7,8,9];for(i = 0; i< 1000000; i++){ rnd = this.game.rnd.weightedPick(test); if(rnd == 9) console.log(rnd);} PS: The way i solved this is by adding a "dummy"(or a placeholder) element in the last place of the array. So, any suggestion for a clean solution?. Thanks in advance.
  5. Input position vs position in group

    Well, I solved my problem, just I used the function : this.game.input.getLocalPosition(container, pointer, new pointer); And this give me the relative position to some container . I expect this can be usefull for somebody. Thanks anyway .
  6. I have a problem when I get the position of Input (click, touch, etc...) in a event and then try to put a sprite in the same position. This happen when the game is in (100%, 100%) screen mode, i.e , the sprites in a scene are responsive to the screen size. In this case, the position of the sprite is "shifted" a space versus the mouse click, the problem is: this "shift" is not constant, and the image is not exactly in the sprite.x(y) position. More details: I have a image 800 x 600 per example in a sprite, this sprite is responsive to the touch or click event, when this happen, I put a new sprite in the position of the click, but... well, the thing I said at the beginning. Thanks.
  7. Webgl-only huge fps drop when mass creating sprites

    Hi, i have similar problems with Webgl, in a very simple state (just a simple sprite) the fps oscillate between 10 ~ 60 (detected with Phaser plugin debug), and with Canvas, everythings is OK (59 ~ 60 fps). some suggestions?, maybe the computer needs some minimal requeriments (Hadware) for a good performance with webgl. In advance thanks.