srobertson421

Members
  • Content count

    14
  • Joined

  • Last visited

  1. Phaser 3 + ES6 + Webpack bootstrap project

    Awesome! Good idea with the boot menu, I'll keep playing around and if I make any more examples I'll shoot over a PR. Cheers!
  2. Phaser 3 + ES6 + Webpack bootstrap project

    I tossed up a spritesheet and input example in my fork if anyone is interested! Thanks nkholski for the repo! https://github.com/srobertson421/phaser3-es6-webpack/tree/dev
  3. Phaser Multiplayer Game Hosting

    This is a go-to Node hosting platform: https://www.nodejitsu.com/
  4. NEW Mobile HTML5 Game – Tower Loot

    Great game! Very polished puzzles, I enjoyed it! Nice work!
  5. Building your Phaser Projects with Browserify

    Thanks for putting this together! All I'm getting when running the "sh start.sh" command is a new browser window with a "pre" element saying "undefined". Any help would be appreciated!
  6. l1 Path Finder

    Very awesome! Thanks for the post Rich!
  7. Hi all! I know this is a pretty obscure issue but I was hoping someone with experience with the Facebook iOS app and HTML5 games could help. Currently I have a game that makes a synchronous ajax request to consume my company's API and retrieve data to use in the game. This is done in the Loading state. The goal was also to have the players be playing it in the Facebook webview since our ads would be focused there. Now on most platforms the game plays fine. It receives the data and goes through the rest of the game execution fine. However on some iOS platforms, mainly iPhone 5S and 6, the call never starts and the game crashes as the data isn't received. My question being, does anyone have experience with the Facebook webview on iOS that could maybe shed some light on why only on some devices is a synchronous ajax request bypassed and others it works fine? Maybe a security issue? Any help at all would be appreciated, no matter how far-fetched! Thanks in advance!!
  8. Parallax background

    MichaelD is correct. Here is an implementation if you need it: preload: function() { // Load our tilesprite image for the background this.game.load.image('background', 'Path/To/Your/Background.png'); // Load our tilesprite image for the ground this.game.load.image('ground', 'Path/To/Your/Ground.png'); }create: function() { // Add the tilesprite for the background to the game at position 0, 0 // params - Xpos, Ypos, Width, Height this.bg = this.game.add.tileSprite(0, 0, backgroundWidth, backgroundWidth, 'background'); // Add the tilesprite for the ground to the game just below the background this.ground = this.game.add.tileSprite(0, backgroundHeight, groundWidth, groundHeight); // Now add our ground to the physics engine for collisions with the player this.game.physics.arcade.enable(this.ground); // Make sure it doesn't react to gravity this.ground.body.allowGravity = false; // Make the ground immovable this.ground.body.immovable = true;}update: function() { // Create collision check for player and ground this.game.physics.arcade.collide(this.player, this.ground); // Finally we move the two tilesprites at different speeds to simulate parallax this.bg.tilePosition.x -= 0.5; this.ground.tilePosition.x -= 1.5;}
  9. Tilesprite collision issue

    Whoops!! Nevermind, I figured it out. Seems I shouldn't have been calling the "collide()" method after my sprite update method. Just called the collision before the update and it works. Is there a way to delete a post to avoid looking like a jackass? lol
  10. Tilesprite collision issue

    Hi guys! I'm currently having an issue with using a tilesprite as the ground for an infinite runner game. Using Arcade physics I set a body to the tilesprite so that I could check collision between my sprite and the ground. The problem comes when the collision actually happens. The sprite body doesn't flag "body.touching" as down nor does it work with "body.onFloor()". A by-product of this issue is that my jump function is negated for some reason. Once my sprite collides with the ground he can't move up at all. Any help would be appreciated!! This is my main game state: Play = function(game) { this.game = game; this.boy = new Player(game); this.girl = new Girl(game); this.bg = null; this.ground = null;}Play.prototype = { create: function() { this.bg = this.game.add.tileSprite(0, 0, 438, 136, 'background'); this.ground = this.game.add.tileSprite(0, 125, 438, 44, 'ground'); this.game.physics.arcade.enable(this.ground); this.ground.body.allowGravity = false; this.ground.body.immovable = true; this.ground.body.setSize(this.ground.width, this.ground.height - 10, 0, 10); this.boy.create(); this.girl.create(); }, update: function() { this.bg.tilePosition.x -= 0.5; this.ground.tilePosition.x -= 1.5; this.boy.update(); this.girl.update(); this.game.physics.arcade.collide(this.boy.player, this.ground); }And here is my player class: Player = function(game) { this.game = game; this.player = null; this.cursors = null;}Player.prototype = { create: function() { this.player = this.game.add.sprite(this.game.world.width / 2, this.game.world.height / 2, 'boy') this.player.anchor.setTo(0.5, 0.5); this.player.scale.setTo(0.5, 0.5); this.game.physics.arcade.enable(this.player); this.player.body.collideWorldBounds = true; this.player.animations.add('run', ['run1', 'run3', 'run2', 'run4'], 8, true, false); this.player.animations.add('jump', ['jump1', 'jump2'], 5, false, false); this.player.animations.add('fall', ['fall1', 'fall2', 'fall3'], 8, false, false); this.cursors = this.game.input.keyboard.createCursorKeys(); }, update: function() { this.player.body.velocity.x = 0; this.player.animations.play('run'); if (this.cursors.left.isDown) { this.player.body.velocity.x = -100; } else if (this.cursors.right.isDown) { this.player.body.velocity.x = 100; } if (this.cursors.up.isDown) { this.player.body.velocity.y = -200; this.player.animations.play('jump'); }Here is a live version: http://largemoose.cloudvent.net/infinite-runner/index.html Thanks in advance!!
  11. Fixing text on sprite

    You can create the underlying sprite first and then place the text at that sprite's coordinates. Then you have the choice of moving them both separately using tweens or grouping them and moving the group using tweens. create function() { // Add initial sprite to put text on. var baseSprite = game.add.sprite(320, 320, 'spriteKey'); baseSprite.anchor.setTo(0.5, 0.5); // Add text sprite second so it renders on top. var spriteText = game.add.text(baseSprite.x, baseSprite.y, 'Sprite Text'); spriteText.anchor.setTo(0.5, 0.5); // Create the group and place both sprites in it. Allows you to move the group instead. var spriteGroup = game.add.group(); spriteGroup.addMultiple([baseSprite, spriteText]); // You can now just tween the group instead and it will move both sprites. var moveGroupTween = game.add.tween(spriteGroup).to({x: 100, y: 100}, 1000, Phaser.Easing.Linear.None, true);}Finally you can simply set the text of the text sprite when you need to change it, that way you only end up using a single text sprite. spriteText.setText('New sprite text');
  12. Tweening a Tint

    Hi lewster32. I know this is an older post but I have implemented a version of your color tween but I'm hitting cross-browser issues. Any reason this wouldn't work in Safari or Firefox?
  13. Texture Atlas Creator

    If anyone is also looking for a quick web app solution for texture atlas and the like, try this out: http://www.leshylabs.com/apps/sstool/ It's worked wonders for me! and you can output to multiple files that are compatible with Phaser. Cheers!
  14. I'm having issues with the callback passed in to the onDown. For some reason when I try to play an animation from within the callback the animation won't play at all. What's strange is the animation will play fine in my key detection in the "update" function. My code is this: Player = function(game) { this.game = game; this.sprite = null; this.cursors = null;};Player.prototype ={ preload: function() { this.game.load.spritesheet('grandpa', 'assets/grandpa.png', 64, 117); }, create: function() { this.sprite = game.add.sprite(2 * 64, 8 * 64, 'grandpa'); // animations this.sprite.animations.add('left', [7,6,5,4], 7, true); this.sprite.animations.add('right', [0,1,2,3], 7, true); this.sprite.animations.add('up', [8,9,10,11], 7, true); this.sprite.animations.add('down', [0,1,2,3], 7, true); this.sprite.animations.add('beer', [0,12,13,0], 7, true); this.cursors = this.game.input.keyboard.createCursorKeys(); var beerButton = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); beerButton.onDown.add(beerDrink, this); function beerDrink() { console.log('beer!'); this.sprite.animations.play('beer'); } }}