in mono

Members
  • Content count

    103
  • Joined

  • Last visited

About in mono

  • Rank
    Advanced Member
  • Birthday 09/11/1991

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

1,060 profile views
  1. in mono

    Resize image = losing quality

    Care to post the original image itself? What are the dimensions of the game? Did you try with numbers instead of percentages inside of strings when calling new Phaser.Game()?
  2. in mono

    Resize image = losing quality

    Try this: logo.smoothed = false; By the way, it doesn't matter which way you use to resize an image - scale changes the image's size and size changes its scale; they're internally tied to each other. DPI doesn't matter unless you print. If you're showing the image on a display, it's all pixels.
  3. Just check the pointer's x. function update() { if (game.input.activePointer.isDown && (game.input.activePointer.x < 200 || game.input.activePointer.x > 400)) { this.sprite.velocity.y += -50; } } Reference: https://photonstorm.github.io/phaser-ce/Phaser.Pointer.html
  4. in mono

    Portrait Mode : What's the Good Size?

    I think a better approach would be to set the game resolution to one of the following the native resolution of each device display a resolution of your choosing, but of the same aspect ratio of the device's display I'd avoid changing the canvas via CSS - it might work for the element itself, but it may skew some positioning calculations (like it seems to be happening with that button) - to remedy that, it'd be a better idea to do it from within Phaser. If you're not going to resize and/or rotate the game, your best bet is to use game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; or better yet game.scale.scaleMode = Phaser.ScaleManager.NO_SCALE; (I suspect the latter will work only if you've set exact resolution). As for the background, if it's not going to repeat (if it's big enough to cover the whole screen), you can go with a regular sprite like this: bg1 = game.add.sprite(0, 0, "bg1"); bg1.anchor.set(0.5, 0.5); bg1.height = game.height; bg1.scale.x = bg1.scale.y; bg1.position.set(game.width * 0.5, game.height * 0.5); What this does is to set the anchor to the middle of the image (it's by default in the top left corner; the 0.5 is a fraction of the width/height), set the height to the game height, then equalise scale.x and scale.y (so that the image doesn't look skewed), then position it in the middle of the game. If the image has some specifics that you want to be visible, you may have to think of another way. The way in the example should work for 16:9 and taller displays; if you want to accommodate 4:3 displays, you might want to do the opposite: bg1.width = game.widht; bg1.scale.y = bg1.scale.x; so that you don't get top/bottom or left/right bars. You might want to do that in an if according to the aspect ratio. Keep in mind that the scale and the width/height are tied and if you change one of them, the other changes accordingly - i.e. if you have a 1000*1000 image, it will have scale (1, 1) initially if you don't resize it; if you set its width to 500, it will have scale (0.5, 1). Haven't tried that with TileSprite, you may try it yourself.
  5. in mono

    Portrait Mode : What's the Good Size?

    Depends on whether you want 1:1 resolution or you'd be fine with lower than that. Generally you should aim for the design to be at least a little bit responsive. Most 2-3 year old phones and tablets are 16:9, but the current trend is 18:9 and 18.5:9; and at the opposite end of the spectrum there's Apple tablets which are 4:3.
  6. in mono

    Create and Destroy Sprites Using Functions

    Haven't tried it, but according to the documentation, you must call the overlap method in your update.
  7. in mono

    Phaser Examples - loading files without states

    Maybe you should refer to this.game instead of just game. Phaser examples do use states, you just can't change them.
  8. in mono

    Is there a code for diagonal dragging?

    I had a similar problem in a company I worked for before. We ended up doing it manually - not relying on Phaser's drag functionality but rather using tweens to update the object after some calculations are done.
  9. in mono

    Moving the Clock Minute and Hour Hand

    I guess you should simply move the hour hand by half a degree for each passed minute. 360 degrees in the whole circle, 30 degrees for each hour (360/12), 0.5 degrees for each minute (30/60) as far as the hour hand is concerned.
  10. in mono

    Creating multiple popups with too many functions?

    Reuse the code and just pass what's different as a parameter. Better yet, make a class for the popups, write the open and close methods for it, then work with instances of that class.
  11. in mono

    GUI suggestion for desktop version

    I'd add that you might take a look at Photoshop's "scrubby zoom". Basically what it does is that it allows you to zoom in and out by click and drag right/left while using the Zoom tool, but that would require an implementation of some sort of tools in your app and I don't know whether you've done that or whether you intend to do it.
  12. in mono

    GUI suggestion for desktop version

    Mouse and modifier keys. Just look at apps meant to be used primarily with mouse and keyboard, i.e. AutoCad, Photoshop.
  13. An anchor is set in fractions, i.e. (1, 1) is the bottom right corner and (0.5, 0.5) is the middle (no matter how big the sprite actually is), whereas a pivot is in pixels (thus different for each sprite).
  14. in mono

    while on array unexpected behavior

    Just swap the increment step with the next line.
  15. in mono

    get state

    It's not "too much info", it's just the whole state object. If you're looking just for an identifier, try this: game.state.getCurrentState().key It will give you the key you used to add the state to the state manager.