ShadowMoon

Members
  • Content count

    6
  • Joined

  • Last visited

  1. Adjusting sprite collider offset after scaling a sprite

    This doesn't work either for scaling and collision... ground.setDisplaySize(360, 140);
  2. Adjusting sprite collider offset after scaling a sprite

    Hmm, I have a ground image that I scaled up by 1.3. And I have it set to collide with a falling object. The falling object doesn't actually collide till it hits the unscaled edge of where the image would be, so basically the falling object goes half way through the ground then collides. I'm using phaser 3.3.0. How would I get the meteor to actually collide with the surface of the ground if I have to scale it? function preload(){ this.load.spritesheet('meteor', 'images/meteor.png', {frameWidth: 32, frameHeight: 32 }); this.load.image('ground', 'images/base.png'); } function create(){ meteor = this.physics.add.sprite(120, 120); meteor.body.allowGravity = true; ground = this.physics.add.staticImage(180, 584, 'ground'); ground.setScale(1.3,1.3); this.physics.add.collider(meteor, ground, crash, null, this); }
  3. Mobile Tutorials or Examples

    Got it! Thanks everyone. I just made a variable moveLeft, set it to false. Then on the pressdown event changed it to true and have the if statement in update check the state. On tap, he hauls ass to the left Now the easy part of getting him moving left, right, and jumping. var moveLeft = false; function create(){ this.input.on('pointerdown', function(){ moveLeft = true; }, this); } function update(){ if (moveLeft) { player.setVelocityX(-160); player.anims.play('left', true); } }
  4. Mobile Tutorials or Examples

    Hey samme, thanks! I was kind of looking at these. And this snippet will move the dude one little frame at a time: this.input.on('pointerdown', function(){ player.setVelocityX(-160); player.anims.play('left', true); }, this); but how can I get the update function to check if pointer is down, similar to what I'm able to do with the cursor keys? This is the example from the tutorial and it makes the dude run left. if (cursors.left.isDown) { player.setVelocityX(-160); player.anims.play('left', true); }
  5. Mobile Tutorials or Examples

    Thanks for the video! He covers a lot on keystrokes and mouse input, but there still is nothing on mobile touch (taps / swipes). I am able to use hammer.js to detect swipes, but incorporating it into the update function is where I'm getting stumped for now. I'm pretty sure there is a way to handle touch events with just Phaser 3 which would be ideal.
  6. Mobile Tutorials or Examples

    Are there any good examples or tutorials for swipes and touch/ tap events for Phaser 3. I am new to game development. I did this tutorial for phaser 3, played around with it, added sounds and such. But the next thing I wanted to do was try and port it to Android. I was able to get most of the look right, but for the life I me I can't figure out how to get the 'dude' to move!!! Any help would be appreciated. Thanks