Jump to content

Search the Community

Showing results for tags 'diagonal'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 4 results

  1. Hi all, I'm making a shmup game at the moment. I'm trying to animate player's diagonal movements but can't get it to work. Any help you could offer would be greatly appreciated. First, I created the animation: this.anims.create({ key: 'rightUp', frames: this.anims.generateFrameNumbers('player', { start: 30, end: 33 }), frameRate: 10, repeat: -1 }); then when the player wants to go up&&right: if(this.keyLeft.isDown&&this.keyUp.isDown){ this.player.anims.play('rightUp', true); var isPaused = this.player.anims.currentAnim; var progress = this.player.anims.getProgress(); // console.log(isPaused) console.log(progress) } Everything else works perfectly fine (e.g. left, right, up, and down). My console just returns 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 when I press the up and left arrow at the same time. In contrast for any other motion, it returns the frame number it's playing. Thank you in advance, Bong
  2. I am trying to move my player diagonally when I press down the 'up' & 'left' arrow keys. My current code is this this.moved = false; if (this.cursors.up.isDown) { this.moved = true; this.player.body.velocity.y -= 100; this.player.play('up'); } if (this.cursors.down.isDown) { this.moved = true; this.player.body.velocity.y += 100; this.player.play('down'); } if (this.cursors.left.isDown) { this.moved = true; this.player.body.velocity.x -= 100; this.player.play('left'); } if (this.cursors.right.isDown) { this.moved = true; this.player.body.velocity.x += 100; this.player.play('right'); } if (!this.moved) this.player.animations.stop();Now if I add the following if(this.cursors.left.isDown && this.cursors.up.isDown){ this.moved = true; this.player.play('upLeft');}and I press down the 'up' and 'left' keys, the player goes up (x=-100 & y=-100) which is what I want however, the animation does not work! It switches to the first frame of that animation but it stops after. So you will see a player sliding diagonally. It might be the "this.player.animations.stop()" that is getting in the way but I can't figure it out. Is there something I am not seeing?
  3. Hi Im not sure if this is possible but for example if you hold the up and right arrow keys the player moves north east. Ive been trying to code this but just can't. Please Help Thanks.
×
×
  • Create New...