Matoking

Members
  • Content count

    3
  • Joined

  • Last visited

About Matoking

  • Rank
    Newbie

Contact Methods

  • Twitter
    Matoking
  1. @chunkhost I can't access my VPS or your site. Hardware failure or something else?

  2. Hey, I'm trying to use BitmapData but I'm having some trouble with its drawSprite method. var bitmapData = game.add.bitmapData(500, 500);var image = game.add.image(0, 0, 'blocks_top', 0);bitmapData.drawSprite(image, 25, 25);bitmapData.drawSprite(image, 50, 50);In this example I'm trying to draw the same image to the BitmapData object two times. However, the image isn't being drawn to the specified coordinates, instead being drawn to the coordinates specified in the Image object. Also, if I want to draw the same sprite multiple times to the same BitmapData, do I need to create a Image/Sprite for each copy of the same sprite, or do I need only one Image/Sprite for each individual sprite? I'm asking because I managed to get the drawSprite method working by changing the to-be-drawn sprite's position to the coordinates passed to the drawSprite method, although I'm not sure if this is the correct way to solve this issue. In this case only the latter drawn sprite was visible (the one drawn to 50,50). EDIT: Now that I think of it, I think the issue has to do with the BitmapData not being rendered for some reason. EDIT 2: Oh right, you need to pass the BitmapData as a texture to a Sprite before you can render it. EDIT 3: I've solved the issue. Turns out all game objects are added to the game world unless they are created through game.make instead of game.add.
  3. Changing game size to fit page

    I probably didn't make it clear in the first post, but I want the game size to be resized even after the game has started. Since the game size seems to be set in stone after the game is started, I'm doubtful if it's doable without modifying the source code. EDIT: Okay, I figured out it's possible to change the screen size by making the default renderer Phaser.CANVAS and adding onresize event to body, which calls the following function. It still has some minor problems, so it's not a full solution just yet. And since it essentially forces you to use canvas instead of WebGL it has quite a lot of performance implications. EDIT 2: Okay, I managed to get it to resize correctly when it's using canvas as a renderer. It would be useful if it worked with WebGL too, so I'll look into getting it to work too. EDIT 3: Alright, I figured out a solution that works with both rendering modes. Add the following line to the part where the game is started: $(window).resize(function() { window.resizeGame(); } );And the function in question: function resizeGame() {var height = $(window).height();var width = $(window).width(); game.width = width;game.height = height;game.stage.bounds.width = width;game.stage.bounds.height = height; if (game.renderType === Phaser.WEBGL){ game.renderer.resize(width, height);}}Seems to work flawlessly, but there could be some unforeseen issues. I don't think Phaser was designed for this. I use jQuery in the examples, but you should be able to get width and height of the window and add the onresize event handler using other methods, too.
  4. Changing game size to fit page

    I just started using Phaser and so far I have really enjoyed using it. I, however, have one problem. With the current project I'm making, I want the game to fill the element that is the parent of the game canvas. Instead of scaling the game screen, which causes the image to become stretched and anti-aliased, I want the game screen to be resized so that game area either becomes larger or smaller which allows more or less game sprites to be visible. Is this possible?