cloakedninjas

Members
  • Content Count

    34
  • Joined

  • Last visited

About cloakedninjas

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    cloakedninjas

Recent Profile Visitors

1220 profile views
  1. 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
  2. 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.
  3. .@Spotify Why is Spotify on Mac cutting out every few seconds? Even for local files ?! Only started happening recently :(

  4. I've created a boilerplate for Phaser, you can grab it here: https://github.com/cloakedninjas/phaser-typescript-boilerplate It's very slim, it provides just the bare minimal components to get going quickly.
  5. 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 https://github.com/DragonBones/DragonBonesJS/issues/18
  6. 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?
  7. 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: https://github.com/photonstorm/phaser/blob/c9c85330ab60547b39ba4c9400c258ed7fb2a317/src/pixi/display/Sprite.js#L423
  8. 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.
  9. 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" />
  10. This topic seems to be mentioned a lot on these forums: http://www.html5gamedevs.com/topic/15167-sprite-jittering-on-velocity/?hl=roundpixels http://www.html5gamedevs.com/topic/12485-sprite-jittering-with-camera-follow/ 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 ?
  11. 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 - https://www.npmjs.com/package/tsd 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)});
  12. 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);}
  13. 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?
  14. 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?
  15. It's a little tricky sure, but if you can control game time and isolate just the entities you want to test, you have a repeatable and reliable test. setGameTime(0);var ball = new BouncyBall(100, 100);setGameTime(100);expect(parseInt(ball.y)).toEqual(143);setGameTime(200);expect(parseInt(ball.y)).toEqual(308);