• Content Count

  • Joined

  • Last visited

About cloakedninjas

  • Rank
    Advanced Member

Contact Methods

  • Twitter

Recent Profile Visitors

1549 profile views
  1. Shameless plug incoming ... I just created a new plugin for Phaser 3 - a Webfont Loader that doesn't rely on TypeKit font loader, nor does it require you to have the WOFF file - instead it injects a <link rel="stylesheet"> and uses FontFaceSet to initiate the load / be alerted of the load. This is something that will speed up (at least my) development time during game jams, as I can just copy and paste the Google webfont URL. You can get it from here: npm Github
  2. Nope - but if there's no easy solution I will add Typescript to future Phaser3 projects. I have a feeling it might be related to the way Phaser is exported. As I'm not getting similar issues when I import express (for example) , I get correct type hinting
  3. I've been giving Phaser3 a go this weekend and I'm finding it much harder to work with as I have no code completion / type hinting inside my IntelliJ editor. In Phaser 2 with Typescript I've been able to get auto complete for things like this.add. [sprite | audio | button etc...] Is anyone else having issues with this? Is code support better in VS.
  4. .@Spotify Why is Spotify on Mac cutting out every few seconds? Even for local files ?! Only started happening recently :(

  5. I've created a boilerplate for Phaser, you can grab it here: It's very slim, it provides just the bare minimal components to get going quickly.
  6. I ended up writing a Node converter on Friday afternoon. However the nail in the coffin is that the latest version of DragonBones generates a skeleton which is not valid for the files provided by Alex_h. I spent hours tracing through the code and deep inside the dragonbones.js file it seems the bones are missing parents and the output Phaser.Group is empty of children. Annoyingly - it seems that the devs have given up on the JS library
  7. So I just gave this a try today - worked straight away. This is great. What's not so great is that when I export the same sample project of that walking Dragon from Dragonbones - the JSON format isn't something I can import into Phaser Phaser.AnimationParser.JSONDataHash: Invalid Texture Atlas JSON given, missing 'frames' objectDragonBones is exporting this type of structure: { "name": "Dragon", "imagePath": "texture.png", "SubTexture": [ { "frameY": 0, "y": 398, "frameWidth": 180, "frameX": 0, "frameHeight": 232, "height": 231, "width": 180, "name": "parts\/legR", "x": 2 }, { "x": 298, "y": 458, "width": 28, "name": "parts\/eyeL", "height": 46 },Did you convert the output from Dragonbones? Or is there an export plugin I need to download?
  8. Well... As a dirty hack I've added the following to my Cloud sprite class: _renderWebGL(renderSession:PIXI.RenderSession) { renderSession.roundPixels = false; super._renderWebGL(renderSession); renderSession.roundPixels = true;}_renderCanvas(renderSession:PIXI.RenderSession) { renderSession.roundPixels = false; super._renderCanvas(renderSession); renderSession.roundPixels = true;}This does the trick, but ideally it would be a property on the Sprite itself, along with checking the global setting:
  9. Creating all your sprites in your preload is ok for that moment in time - but if you're making a real-time multiplayer game you'll need to handle users leaving + joining at will. You should create a map of users, and use the same function to create a user on init() and during the lifetime of your game, e.g: var userList = {};function addUser(id) { var sprite = game.add.sprite(x, y, 'img'); sprite.anchor.x = 0.5; userList[id] = sprite;}function init(playerList) { playerList.forEach(function (player) { addUser(player); }, this);}//socketManager.on('connect', init.bind(this));socketManager.on('new-user', addUser.bind(this));As for your current issue, it seems that your human_sessionplayer isn't defined in the update() scope. Add a debugger; statement just before you use it to see what the value is.
  10. You shouldn't be compiling your .d.ts file. ### Fast Compile >>ts/phaser.d.tsI'd check your Grunt task isn't including these. For reference here's one of my configs: grunt.initConfig({ ts: { development: { src: ['src/scripts/**/*.ts'], dest: 'public/js', options: { module: 'amd', target: 'es5', sourceMap: true, sourceRoot: '/ts', declaration: false } } },And probably good to create a single reference.d.ts file which manages your definition imports in a single location, e.g. /// <reference path="../../typings/tsd.d.ts" />/// <reference path="../../bower_components/phaser/typescript/phaser.comments.d.ts" />/// <reference path="../../bower_components/phaser/typescript/pixi.comments.d.ts" />
  11. This topic seems to be mentioned a lot on these forums: Now I have similar question. Originally I started out by having this set to true to ensure I had crisp textures. But I added some slow-moving clouds to my background and this caused them to jitter, obviously they're move so slowly that when their position was rounded, it caused movement that was larger than it should have been Is there a way I can allow certain sprites to be rendered at sub-pixel values (and be aliased) while the rest follow the global game.renderer.renderSession.roundPixels = true ?
  12. A little late to the discussion, but you don't need to forge an interface like that - there's a repo of Typescript definitions you can use called DefinitelyTyped - Once you've installed it, globally: tsd install webfontloader --saveWhich will put in place the the .d.ts file allowing you to do the following in your preloader WebFont.load(<WebFont.Config>{ google: { families: ['Raleway'] }, classes: false, active: this.startMainMenu.bind(this)});
  13. In writing this post I figured it out, so rather than scrap this, I thought I'd post the solution - perhaps it can help someone in the future: The ScaleManager gets initialised in the boot() method, so you can do the following: boot() { super.boot(); this.scale.setGameSize(window.innerWidth * this.devicePixelRatio, window.innerHeight * this.devicePixelRatio);}
  14. Typescript says you the first call of constructor() should be super() so this isn't possible: constructor() { var devicePixelRatio = Math.min(Math.round(window.devicePixelRatio), 3) || 1; super({ renderer: Phaser.AUTO, width: window.innerWidth * devicePixelRatio, height: window.innerHeight * devicePixelRatio });}But then doing this gets the error: Cannot read property 'setGameSize' of null constructor(gameVars:any) { super({ renderer: Phaser.AUTO, parent: 'canvasContainer' }); var devicePixelRatio = Math.min(Math.round(window.devicePixelRatio), 3) || 1; this.scale.setGameSize(window.innerWidth * devicePixelRatio, window.innerHeight * devicePixelRatio);}When does the ScaleManager come into existence?
  15. If you could post a snippet of one of these game objects and how it stores and interacts with Phaser.Sprite that would be good. Though I wonder how you would go about storing properties related to both, for instance position (x & y). Do you duplicate this property, once in your game object and once in your view?