Tom Atom

Members
  • Content count

    558
  • Joined

  • Last visited

  • Days Won

    5

Tom Atom last won the day on August 7 2016

Tom Atom had the most liked content!

4 Followers

About Tom Atom

  • Rank
    Advanced Member

Contact Methods

  • Website URL
    https://twitter.com/SBC_Games
  • Twitter
    SBC_Games

Profile Information

  • Gender
    Male

Recent Profile Visitors

3,176 profile views
  1. 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...
  2. 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?
  3. 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:
  4. Best way to handle Character with shadow

    this is the best option in my opinion.
  5. 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.
  6. 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.
  7. 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 ...
  8. 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: https://marketplace.visualstudio.com/items?itemName=Rich-Newman.TypeScriptHTMLApplicationTemplate For me, in VS 2015, worked always to put Phaset stuff into "lib" folder.
  9. 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.
  10. Stop and restart a tween/recycling tweens

    Hi, long time ago I solved reusing stopped tweens - here is detailed topic about it:
  11. 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' }); }
  12. how to access my assets in jsdeliver

    @samme - thanks for explanation & help! It works for me now. I tried "anonymous" before without luck, but it was messed with second problem - sever is returning URL link without protokol (like //cloudgames.com/ ....) and if I converted it into absolute URL, it added http (because my dev server is http). But server is returning image only if asked for with https. If I ask for it with correct protokol, then everything works.
  13. how to access my assets in jsdeliver

    @samme thanks for answer, but are you sure? With Phaser none of "" or "anonymous" work - in both cases texture cannot be used in WebGL. That linked tutorial is using "" and it works (it also works with setting to "anonymous"). In fact, this is image I am trying to load and use: "https://cloudgames.com/app/img/logo-horizontal.png" - it is sponsor logo. It can load & use it only if used that way I described above (no matter if I set it to "" or "anonymous" , but if I omit this line: img.crossOrigin = ""; I get this error ... which is exactly what that tutorial was about (how to use CORS texture in WebGL) Now, I am struggling with http x https. If URL for image is https it works, if it is http, then it does not work. Looks like sponsors emulator is returning http, but luckily production looks to return https (I debugged one PIXI game there).
  14. how to access my assets in jsdeliver

    Hi, Phaser way: let imageUrl = "https://cloudgames.com/app/img/logo-horizontal.png"; this.load.crossOrigin = ""; this.load.image("LOGO", imageUrl); did not work for me too - all I got was "SecurityError: The operation is insecure.". But then I found this tutorial: https://webglfundamentals.org/webgl/lessons/webgl-cors-permission.html and this worked for me: var cache = this.cache; var img = new Image(); img.addEventListener('load', function () { console.log("***** LOADED ***** "); cache.addImage("LOGO", imageUrl, img); }); img.crossOrigin = ""; img.src = imageUrl; Now you can create your sprite like this: var logo = this.game.add.sprite(0, 0, "LOGO");
  15. [Phaser] Pirates! - the match 3

    @Spyro23 didn't know this trick. It sounds interesting - thanks!