Jump to content

Areg

Members
  • Posts

    12
  • Joined

  • Last visited

Contact Methods

  • Twitter
    @peterareg

Areg's Achievements

Newbie

Newbie (1/14)

1

Reputation

  1. Areg

    roundedRect as mask

    // 'this' is a normal group // this method works var img = game.add.image(0, 0, 'something'); this.add(img); var graphics = game.add.graphics(0, 0, this); graphics.drawRectangle(0, 0, 200, 40); img.mask = graphics; // this does not var img = game.add.image(0, 0, 'something'); this.add(img); var graphics = game.add.graphics(0, 0, this); graphics.drawRoundedRect(0, 0, 200, 40, 5); img.mask = graphics;
  2. Hi there! I am using regular rectangle as a mask for an image. It works fine. But when I try to change that graphics to draw rounded rectangle (instead of rectangle), and try to use that as a mask, following exception gets thrown out 'Uncaught TypeError: Cannot read property '0' of undefined'. Does anyone know how to deal with this?
  3. HI there. A general question : is Phaser.Group expensive in terms of performance? For example, I have a game where I create hundreds of Phaser.Groups, assign images/sprites/texts to them etc. I noticed that FPS started to drop heavily. I can remove all those Phaser.Groups, create images/sprites/texts without them, but will that significantly improve FPS?
  4. HI. Is there any way to add strikethrough style (like this) to Phaser Text? I cannot just use textWidth and draw a line on it for that, because my text has word wrap applied to it so it may consist of several lines. Thanks.
  5. Hi there. I have some sprites which all have physics p2 bodies enabled. I've added all those sprites to a some group. But when I try to scale down/up that group or just change it's position, bodies of those sprites stay where they currently where positioned. ie, when I scale down the entire group to, say (0.5, 0.5), all the sprites in that group scale down to half their size normally, but their p2 bodies stay where they are and don't resize. I'm guessing there must be some way to add sprites' bodies to the group, so they can be resized/be moved normally as their parent sprites?
  6. Hi there. I have a sprite, it is a wheel. I set it's anchor to it's center. I need to add spinning ability to it by input : holding mouse on some edge of that wheel, dragging it around its center(anchor), and releasing mouse so that it will spin on and on, and will have a force applied to it that will make it slow down it's speed until it's stopped (basically, natural spinning of a wheel). I suppose I should use Phaser's Physics for it, but which one? And are there any methods to do that? Thanks.
  7. I know from examples that there are ways to capture keyboard events in the update() function of the game( that is, polling of events). But is there a way in phaser to register listeners to all keys/specific keys of keyboard. For example I created on-screen keyboard for my game, but I also want to listen to the physical keyboard. Thanks
  8. ah, it works. onBlur events are fired normally and there seems to be no auto pausing , thanks a lot
  9. when stage.disbleVisibilityChange is true, onBlur and onFocus events are not being fired, as expected But there has to be some other way to prevent game from auto pausing
  10. I am listening to game.onPause event. that only works if stage.disablevisibilityChange is false. Other than game.onPause, I do not know about any other event that says that browser lost control that I can listen to
  11. I want to detect the visibility change in my game ( that is, when , for instance, browser tab loses focus, for example). I know that when that occurs, Phaser automatically pauses my whole game system. I want to prevent that automatic pausing, but still I want to receive signal/event about this visibility change.
  12. I have a sprite and want to know when it is double clicked. As far as I know, there is no such built-in event/signal in Phaser(great framework, btw ). Is there any way to check if sprite has been double-clicked? I know about the doubleTapRate property, but I'm not sure how to use it. How to check if the last click has been clicked within the given doubleTapRate?
×
×
  • Create New...