nickbyfleet

Members
  • Content count

    2
  • Joined

  • Last visited

  1. Game list of phaser games

    We just did this at Heyday and JWT New Zealand using Phaser to promote youth enrolment in our upcoming elections. Battle to the Beehive
  2. Virtual joystick plugin for Phaser and Typescript

    I've been banging my head against the wall all day trying to get the virtual joystick plugin to play nice with a Phaser/Typescript project... after 3 or 4 disastrous approaches, I've finally got it working. It's not ideal, but solution is to host the plugin externally and then use the game.load.script() approach while casting the Phaser.VirtualJoystick object as any: // In preload() if (!this.game.device.desktop || this.forceMobile) { // Preload the joystickPlugin plugin this.game.load.script('joystick', 'https://s3-ap-southeast-2.amazonaws.com/url-obscured-to-prevent-abuse'); this.load.atlas(Assets.Atlases.ArcadeJoystick.getName(), Assets.Atlases.ArcadeJoystick.getPNG(), Assets.Atlases.ArcadeJoystick.getJSONArray()); } // In create() if (!this.game.device.desktop || this.forceMobile) { // Load the joystick and buttons this.joystickPlugin = this.game.plugins.add(Phaser.VirtualJoystick as any); this._stick = this.joystickPlugin.addStick(0, 0, 200, Assets.Atlases.ArcadeJoystick.getName()); this._stick.alignBottomLeft(100); this.buttonP = this.joystickPlugin.addButton(this.game.width - 330, this.game.height - 150, Assets.Atlases.ArcadeJoystick.getName(), 'button2-up', 'button2-down'); this.buttonS = this.joystickPlugin.addButton(this.game.width - 215, this.game.height - 220, Assets.Atlases.ArcadeJoystick.getName(), 'button1-up', 'button1-down'); this.buttonK = this.joystickPlugin.addButton(this.game.width - 100, this.game.height - 150, Assets.Atlases.ArcadeJoystick.getName(), 'button3-down', 'button3-up'); } I signed up to post this snippet in the hope this saves someone else a headache.