Tom Atom

  • Content count

  • Joined

  • Last visited

  • Days Won


Tom Atom last won the day on August 7 2016

Tom Atom had the most liked content!


About Tom Atom

  • Rank
    Advanced Member

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender

Recent Profile Visitors

3,321 profile views
  1. Tom Atom

    Box2d revoluteJoint - Knife Hit game

    Hi, using Box2D for such game is overkill... You do not need physics simulation for this game. Make wooden circle as Phaser.Group and place it into world space. Then throw knives in world space and when its blade tip position is less or equal to circle center minus radius, then calculate its position in circle space and make it child of circle Phaser.Group. Here is image of result & minimal working code for game: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Knife hit</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <script src='js/phaser.js'></script> <script> var game = new Phaser.Game(800, 600, Phaser.AUTO, "phaser-example", { preload: function () { // circle with radius 100 pixels game.load.image("circle", "assets/circle.png"); // knife sprite 15 x 50 pixels game.load.image("knife", "assets/knife.png"); }, create: function() { game.stage.backgroundColor = 0x4d4d4d; // knife this.knife = this.add.sprite(400, 500, "knife"); this.knife.anchor.set(0.5, 0.1); // circle = this.add.sprite(400, 150, "circle");; // rotate circle this.add.tween({ angle: 360 }, 2500, Phaser.Easing.Linear.None, true, 0, -1); }, update: function () { // is knife already child of circle? if (this.knife.parent === { return; } // move knife this.knife.y -= 200 * game.time.elapsedMS / 1000; // check hit if (this.knife.y - <= 100) { // move knife into circle space this.knife.position.add(,; this.knife.position.rotate(0, 0,, true); this.knife.angle =; // make circle parent of knife; } } }); </script> </body> </html>
  2. Tom Atom

    [Phaser] Baseball Hero

    Found it among games here: Nice little game. Did you implement any FB ads to monetize it? (I got none on PC during a few games, but as I am right, they appear only on mobile devices)
  3. Tom Atom

    [Phaser] Rabbit Run

    @enriqueto thanks! 🙂 Graphics was made by Tomas Kopecky. You can see some of his work here:
  4. Tom Atom

    [Phaser] Rabbit Run

    Hi, Rabbit Run is our endless runner game made for Japanese market. You can play it here: In fact it is reskinned and adjusted Goblin Run ( - game I made for my Phaser programming book ( We added some animations and tutorial, changed score calculations and made a few optimizations.
  5. Tom Atom

    Does Phaser 3 need Containers?

    Thanks for answer. Yes, I understand this. If engine cares, you can keep your code smaller and better maintainable (not repeating this basic transform stuff all the time) and focus more on game itself...
  6. Tom Atom

    Does Phaser 3 need Containers?

    In recent voting for next feature to be implemented, I voted for Containers. I thought it will be possible to nest them... Did I make it right, that for now all objects in fact have only their world space position and rotation? I think that some way to build object hierarchies and place some objects into local space of other objects is essential for making games. Imagine this example: some sphere orbiting main character. In Phaser v2 I would put sphere as child of player in some distance from 0,0 position, so I will have hierarchy chracter->sphere. In sphere update I will care only about orbiting position. Following player when he moves is provided by hierarchical transforms. If I wanted to offset center of orbiting I could simply put empty group between character and sphere and change hierarchy like this: character->empty_group->sphere. How can I do thing like this in Phaser v3? Does it mean, I have to check in sphere update every frame new position of character and update sphere position to it?
  7. Tom Atom

    too many draws, need some help

    You do not precise how you are drawing individual points. If one by one with something like RenderTexture.RenderXY(), then points are not batched. Instead create group, put points into it and then draw whole group at once. I had similar problem in past, here is detailed post:
  8. Tom Atom

    Best way to handle Character with shadow

    this is the best option in my opinion.
  9. Hi, I am pretty sure, that "game.debug.text" will be first thing, that will slow your game down a lot. Second thing may be using non-sprite font for text. I also believe, that your game (example) runs very slowly even if not wrapped with Cordova (if run directly in mobile browser). From my experience also calling console.log often slows game a lot, so be sure to comment out these outputs in production code.
  10. Tom Atom

    How to use the Phaser in Visual Studio 2017

    Could you put screenshot of your project hierarchy here? You can also try to put Phaser reference to the top of your file - something like this: /// <reference path="../lib/phaser.d.ts" /> For me, I do not have to do it - VS finds all *.d.ts files in lib folder, but it may help to explicitely set reference to it.
  11. Tom Atom

    Physics bug

    - in original example, you are using setBoundsToWorld incorrectly. This is from source doc: /** * Sets the bounds of the Physics world to match the Game.World dimensions. * You can optionally set which 'walls' to create: left, right, top or bottom. * * @method Phaser.Physics#setBoundsToWorld * @param {boolean} [left=true] - If true will create the left bounds wall. * @param {boolean} [right=true] - If true will create the right bounds wall. * @param {boolean} [top=true] - If true will create the top bounds wall. * @param {boolean} [bottom=true] - If true will create the bottom bounds wall. * @param {number} [collisionCategory=1] - The category (bitmask) to use for the walls. * @param {number} [collisionMask=0xFFFFFFFF] - The mask (bitmask) to use for the walls. */ setBoundsToWorld: function (left, right, top, bottom, collisionCategory, collisionMask) { ... it is again about category / mask. But you passed "false" as 5th parameter instead of category. See default values in code above. - for ship1 you are setting category to 1 and leaving collisionMask to default (which is 0xFFFF) - it says: "hey, I am from category 1 and I am colliding with EVERY other category". Which means: collide with bounds (category 1), other player-like ships (category 1) and both enemy ships (category 2) and everything else in physics world and any other category that may appear later... - for ship2 and ship3, you are setting category to 2 and mask to 3 (= 1+ 2). It says: "I am from cat. 2 and I am collidiong with category 2 and category 1) - ships will now collide with bounds (cat. 1), player ship (cat 1) and with each other (cat 2). It will not collide with asteroids, planets, etc. if they are category 4 or 8 or 16 or ...
  12. Tom Atom

    How to use the Phaser in Visual Studio 2017

    Hi, still on VS 2015, but friend of mine had the same problem in VS 2017 as you have - missing tamplate. It looks this template is not in VS 2017 anymore... ...but, some guy created it. Try it here and let others know, if it worked: For me, in VS 2015, worked always to put Phaset stuff into "lib" folder.
  13. Tom Atom

    Physics bug

    First, sorry, this description was confusing: ship1.body.setCollisionMask(4); // - will collide only with ship2 (category 2) should be: ship1.body.setCollisionMask(4); // - will collide only with ship3 (category 4) What you are building in code is kind of collision grid like this: Take row, assign category to your object - like category 1 for ship1 and determine what all other categories you want it collide with (columns for ship2 and ship3). Then set collisionMask to sum.
  14. Tom Atom

    Stop and restart a tween/recycling tweens

    Hi, long time ago I solved reusing stopped tweens - here is detailed topic about it:
  15. Tom Atom

    Physics bug

    Hi, try to combine setCollisionCategory with setCollisionMask. By default mask is 0xFFFF - collide with all other groups. Mask has to be set on both bodies (therefore setCollisionMask(1) on both ships). This works: function create() { game.physics.startSystem(Phaser.Physics.BOX2D); game.stage.backgroundColor = '#2d2d2d'; // User-controlled ship ship1 = game.add.sprite(250, 300, 'ship'); game.physics.box2d.enable(ship1); ship1.body.setCircle(14); ship1.body.setCollisionCategory(1); //ship1.body.setCollisionMask(2 + 4); // - will collide with ship2 (category 2) and ship3 (category 4) ship1.body.setCollisionMask(4); // - will collide only with ship2 (category 2) // Ship with collision category 2 (triggers contact callback only once) ship2 = game.add.sprite(200, 200, 'ship'); game.physics.box2d.enable(ship2); ship2.body.setCircle(14); ship2.body.setCollisionCategory(2); ship2.body.setCollisionMask(1); // Ship with collision category 1 *default, i guess* (triggers contact callback TWICE) ship3 = game.add.sprite(300, 200, 'ship'); game.physics.box2d.enable(ship3); ship3.body.setCircle(14); ship3.body.setCollisionCategory(4); ship3.body.setCollisionMask(1); game.physics.box2d.setBoundsToWorld(true, true, true, true, false); ship1.body.setCategoryContactCallback(1, function(b1,b2,f1,f2,begin){ if (begin){ total += 1; hitText.text = 'Contact callback called '+total+' times'; console.log("CONTACT: ", b2) } }, this); cursors = game.input.keyboard.createCursorKeys(); game.add.text(5, 5, 'Use arrow keys to move.', { fill: '#ffffff', font: '14pt Arial' }); total = 0; hitText = game.add.text(5, 30, 'Contact callback called 0 times', { fill: '#ffffff', font: '14pt Arial' }); }