• Content Count

  • Joined

  • Last visited

About praine

  • Rank

Contact Methods

  • Twitter
  1. Hi Bruno, thanks for that. Unfortunately, I need a specific sprite not the whole canvas. Any other ideas would be appreciated. Cheers! Paul
  2. Hi all, I've looked in the documentation, but can't seem to find anything referring to this issue. I've loaded a spritesheet through Phaser, but I want to use one of the frames of the spritesheet in the DOM, not on the canvas, and was wondering whether this was possible? Maybe a method to export the frame to a DataURI that can be used in the DOM? Cheers! Paul
  3. Thanks for that, samme, I'll give it a go.
  4. Thanks for your response, drhayes. This is the code snippet I ended up using as a workaround until I figure out something better: while([n].children.length>0){[n].children.forEach(function(c,i){c.destroy()}) } Where 'n' is the index of the Slick container in
  5. Hi all, I'm trying to use Slick UI to dynamically create multiple choice question prompts in a new game (see image). The problem is, there doesn't seem to be a way to remove a panel, or update its child elements once they have been created. I couldn't find a way to do this directly through Phaser either. Any help greatly appreciated. Perhaps there is a Phaser method to destroy all children generated by a particular plugin? Cheers, Paul.
  6. Hi all, I've implemented a working solution, but not sure if it's the best way to do it. When a collision is detected with the applicable tile, it is removed, and then a sprite with the exact same image is placed in the exact same position. I then use a tween to create the bounce effect, before removing the sprite and replacing the tile again. The code looks like this: hitbox:function(sprite,tile){ if(sprite.body.blocked.up){ if(tile.index==23){ pf.sfx.sounds['box'].play();,tile.y,pf.boxes); var box =, tile.worldY, 'tiles'); box.frame=22; // properties, duration, ease, autoStart, delay, repeat, yoyo var { y: box.y-50 }, 100, Phaser.Easing.Linear.InOut, true, 0, false, false).to( { y: box.y }, 100, Phaser.Easing.Linear.InOut, true, 0, false, false); bounce.onComplete.add(function(){ box.destroy();, tile.x, tile.y, pf.boxes); }, this) } } }, Resulting animation:
  7. Hi all, I'm making a Maio-esque platformer, and I'm trying to figure out how to make a tile "bounce" (a bit like the attached GIF, but ideally when hit from below rather than from above) If there are any built in functions or plugins to achieve the desired effect, I would very much appreciate the info. Best, Paul
  8. Hi again, I'm now console logging sprite.body.blocked.up and it gives true when hitting the tile from below, but when logging the whole sprite object and expanding the body.blocked property, it gives false. Hmm. I always thought console.log() gave the value of objects at the time the method was called, but it seems to be giving the value at a later time.. perhaps when the property is expanded?
  9. Hi drhayes, thanks for your reply. I don't seem to have that method available, I only have "onFloor" and "onWall" (Phaser 2.1.2)
  10. Hi All, I have a Mario-esque game where player can run around and punch boxes from underneath to get rewards. I am setting up the tile layer with: pf.boxes ='boxes');, 5000, true, 'boxes'); Then I'm doing:, pf.boxes, pf.hitbox, null, this); on the update loop to handle the collision with boxes. The "hitbox" function receives the player object and the tile object thusly: hitbox:function(sprite,tile){ console.log(sprite,tile); }, The output of sprite.body.touching gives false for all directions, and sprite.body.blocked gives true for down, so it's as if I'm not getting a readout of the player object at the time when it collided with the box, but rather after it landed back on the ground. How do I get a readout of the player object at the time it actually hit the box? Thanks in advance, Paul
  11. Hi @nkholski, thanks very much for your reply. I figured out how to get the tile index from Tiled (see attached image) and then I figured out that this number (index) applies to ALL tiles of the same type, which makes things a lot easier, so I can target all "platform" type tiles in one go. As you said, you have to add 1 to the index reported in Tiled to make it work. However, I still can't quite figure out how to access one specific tile and change its sprite image/opacity or destroy it, etc. Any further help greatly appreciated.
  12. Hi all, quick update. I've partly solved the issue.. I figured out the reason the player avatar wasn't colliding with the wall was because I was directly manipulating its x coordinates rather than using velocity (as per this thread). However, now I have the opposite problem: the player is colliding horizontally with parts of the blocked layer as well as the wall layer. I found a function that allows one-way (vertical only) collision on a specific layer, but it requires a list of tile IDs that I'm not sure how to get. I just want the player to collide ONLY vertically (down) with any non-blank tile on the blocked layer. Thanks in advance
  13. I'm a newbie with Phaser tile maps. I've created a simple Mario-esque platform game where the player can jump around and land on platforms. This all works fine, but now I'm trying to add some "walls" to the level which the player should not be able to pass through horizontally, and can't figure out how to get this behavior working (see attached illustration for better explanation) Here's the code I'm using to read the tilemap data and set up collision: ='level2'); //the first parameter is the tileset name as specified in Tiled, the second is the key to the asset'tiles_spritesheet', 'gameTiles'); //create layers pf.blockedLayer ='blockedLayer'); pf.walls ='walls'); //collision on blockedLayer, 5000, true, 'blockedLayer');, 5000, true, 'walls'); The "walls" layer should collide with the player on all sides, and the "blocked" layer should only collide on the top. Currently both the "walls" layer and the "blocked" layer are colliding with the player only on the top. Any help or advice very much appreciated!