• Content Count

  • Joined

  • Last visited

About mandarin

  • Rank

Contact Methods

  • Twitter
  1. If I understand what you want to achieve, the problem lies in the parameters you pass to your group's constructor. You are passing a reference to, which is being set as the group's parent in the constructor. According to the documentation, you can pass null to the parent parameter to prevent the group from being added to world. When you do that, you can do this.add.existing(group). var alienGroup = new AlienGroup(null, 'easy')this.add.existing(alienGroup);
  2. Very impressive! You'd make it very accessible by making the tool a Node.js package and installable from npm. And by having a Grunt task to go with it, it would fit existing workflows easily.
  3. Yes, I am. Thanks. Gah... Maybe I should just revert to 1.1.3.
  4. I replace a tile with no collision with one that has, but the collision info stays the same. You can reproduce this by using the paint tiles example. Apply collision to a couple of tiles by using setCollisionBetween() and enable debug on the tilemap layer. Paint with tiles that has collision and you'll see the debug lines never update. You can try it yourself at Shift + click the tiles within the green border, click to paint them anywhere. There's also a test for 1.1.3 at I couldn't find any debug drawing for tilemaps in 1.1.3 so I added the race car from another example. Use the arrows to drive around. You'll see the car stop at the tiles that has collision enabled. Painting new tiles and watch the car stop at them too. How come this worked in 1.1.3 and not in 1.1.5? Am I doing something wrong?
  5. I filed this as an issue (467) since I was able to "fix" it. My fix is probably not the solution, but it does help.
  6. I can't get the collide callback to work properly, even on the Mario example. I added a callback, and the only time it gets called is when the player is touching a corner of a tile. Never when I e.g. run into one of the green pipes, or hit the ground.
  7. Hello. I'm experiencing some issues with collision between sprites and tilemaps, and cannot figure out how to fix it. It used to work in 1.1.3, so I have clearly messed up something. You can see for yourself here: Use WASD to move and click the mouse to shoot a wooden box. I have limited the shooting to only one box, so you have to reload the page to shoot again. It made it easier to track what's happening. I want the collision callback to fire when the sprite hits a wall so that I can kill the box. The callback only triggers when you shoot at the corner of a tile, and never when the box hits a wall perpendicular. I'm using Phaser 1.1.5. View source to see how I did it. Source code pasted here, in case you prefer that. Bullet = function(game) {, game, -100, -100, 'stuff', 0); this.anchor.setTo(0.5, 0.5); this.outOfBoundsKill = true;};Bullet.prototype = Object.create(Phaser.Sprite.prototype);Bullet.prototype.constructor = Bullet;var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'gameContainer', {preload:preload, create:create, update:update, render:render});var map;var layer;var player;var cursors;var bullets;var w, a, s, d;var counter = 0;var fireRate = 100;var nextFire = 0;function preload() { var assets = { spritesheet: { player: ['players.png', 16, 16], bullets: ['bullets.png', 32, 32], stuff: ['jerom_eiyeron.png', 16, 16] }, tilemap: { map01: ['map02.json', null, Phaser.Tilemap.TILED_JSON] }, image: { dungeon: ['DF_Tilemap01.png'] } }; Object.keys(assets).forEach(function(type) { Object.keys(assets[type]).forEach(function(id) { game.load[type].apply(game.load, [id].concat(assets[type][id])); }); });}function create() { map = game.add.tilemap('map01'); map.addTilesetImage('DF_Tilemap01', 'dungeon'); map.setCollisionBetween(0, 15, true, 0); layer = map.createLayer('Walls'); layer.resizeWorld(); layer.debug = true; player = game.add.sprite(48, 48, 'player', 0); cursors = game.input.keyboard.createCursorKeys(); w = game.input.keyboard.addKey(Phaser.Keyboard.W); a = game.input.keyboard.addKey(Phaser.Keyboard.A); s = game.input.keyboard.addKey(Phaser.Keyboard.S); d = game.input.keyboard.addKey(Phaser.Keyboard.D); bullets =; bullets.add(new Bullet(game));}function update() { player.body.velocity.x = 0; player.body.velocity.y = 0; if (w.isDown) { player.body.velocity.y = -200; } else if (s.isDown) { player.body.velocity.y = 200; } if (a.isDown) { player.body.velocity.x = -200; } else if (d.isDown) { player.body.velocity.x = 200; } if (game.input.activePointer.isDown) { var bullet = bullets.getFirstDead(); if (bullet !== null) { fire(bullet); } else { bullet = bullets.getAt(0); bullet.kill(); bullet.revive(1); fire(bullet); } } game.physics.collide(player, layer); game.physics.collide(bullets, layer, bulletHitWalls);}function fire(bullet) { if ( > nextFire && bullets.countDead() > 0) { nextFire = + fireRate; bullet.reset(player.x, player.y); var angle = game.physics.angleToPointer( bullet, game.input.activePointer); bullet.body.velocity.x = Math.cos(angle) * 300; bullet.body.velocity.y = Math.sin(angle) * 300; }}function bulletHitWalls(bullet, wall) { bullet.kill(); console.log('wall tile index',wall.tile.index);}function render() { game.debug.renderText('Active Bullets: ' + bullets.countLiving() + ' / ' +, 32, 32);}
  8. Hi Thomas. Awesome project! I like your games. :-) I'm doing a similar project. My new year's resolution is to make a game prototype each week throughout 2014. I limit myself to only spend 6 hours per prototype, so they're like mini game jams. And my name is also Thomas. :-) Good luck with your project! Looking forward to your next games. -- Thomas
  9. Ok, that works. According to the documentation Phaser.Group accepts only 4 parameters. Is the 5th documented?
  10. Hi. I use Phaser 1.1.3, and this code gives me this error: Uncaught TypeError: Object TurnGroup has no method 'addChild' at line 10897 Here's the code: <!DOCTYPE html><html lang="en" xmlns=""><head> <meta charset="utf-8" /> <script src="js/phaser.min.js"></script></head><body><div id="gameContainer"></div><script type="text/javascript">SQ = {};SQ.Game = function(game) { = game;};SQ.Game.prototype = { create: function() { this.turn = new SQ.Turn(this); }};SQ.Turn = function(sq_game) {,, 'TurnGroup', true);};SQ.Turn.prototype = Object.create(Phaser.Group.prototype);SQ.Turn.prototype.constructor = SQ.Turn;window.onload = function() { var game = new Phaser.Game(288, 512, Phaser.CANVAS, 'gameContainer'); game.state.add('Game', SQ.Game); game.state.start('Game');};</script></body></html>
  11. Hello! I just finished a rather long article on using Node.js, Grunt and Texture Packer for javascript game development. It's 3.600 words, so make yourself a cup of coffee and get something to eat before you start. :-) The article can be found here: In the article I explain how I setup my workspace, how I used Grunt for automating tasks and creating watchable directories so that the deploy directory always stays up to date. I also created an example project which you can clone/download from Was this useful? Too long? Easy to understand? I'd like to know. :-) -- Thomas
  12. That's it. Such a silly mistake. :-) Thanks!
  13. Hi. I'd like to create a component that extends Phaser.Group so that I can add elements to it, and then add the entire component to anywhere in my game. But, it seems like I'm misunderstanding something. This is my code: GameName.Entity = function(game) {, game);};GameName.Entity.prototype = Object.create(Phaser.Group.prototype);GameName.Entity.prototype.constructor = GameName.Entity;GameName.SomeStage = function(game) {};GameName.SomeStage.prototype = { var entity = new GameName.Entity(; // Throws: Uncaught TypeError: Cannot set property '_iPrev' of undefined; }};What am I doing wrong?
  14. mandarin

    CanvasMark 2013

    Oh la la! That sounds like a Mac Pro. I have the 15" MacBook Pro Retina, 2.7Ghz i7, 16GB RAM, Nvidia GeForce GT 650M.
  15. mandarin

    CanvasMark 2013

    Wow! There's quite a difference between Chrome and the others. Chrome 25, OS X: 17.783 Safari 6, OS X: 11.062 Firefox 19, OS X: 11.351 Opera 12.12, OS X: 7.837