Jump to content

Search the Community

Showing results for tags 'AngularVelocity'.

  • 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 2 results

  1. I'm currently using p2 to move a ship in a similar way as shown in the image above (Note: the demo above only looks like it works, but it actually moves in basically any random direction except the one is facing) The problem number one is the sprite of the ship. The angle "cero" seems to be by default facing up in p2, but in my sprite it's not quite looking up. The second issue comes with the "snapping". I wan't to make the ship always face either 45degrees, -45degrees, 135degrees or -135degrees. This was the idea the hole time. I'm thinking that maybe I'm over-complicating myself, and I should have just make the sprite flip and change the direction at once, but now that I've seen how it looks like when the sprite "slowly rotates" from one direction to the other, I would like to achieve the same result! This is my code so far on create() //create player player = game.add.sprite(game.world.centerX, game.world.centerY, 'ship'); //enable player physics game.physics.p2.enable(player); player.body.collideWorldBounds = true; player.body.angle = (Math.PI/4); // By default the ship will collide with the World bounds, // however because you have changed the size of the world (via layer.resizeWorld) to match the tilemap // you need to rebuild the physics world boundary as well. The following // line does that. The first 4 parameters control if you need a boundary on the left, right, top and bottom of your world. // The final parameter (false) controls if the boundary should use its own collision group or not. In this case we don't require // that, so it's set to false. But if you had custom collision groups set-up then you would need this set to true. game.physics.p2.setBoundsToWorld(true, true, true, true, false); /* Player animations version 1.0 normal: the player is in first frame. May as well be not moving. begin_fly: the player is begining to fly. fly: the player is flying. */ player.anchor.set(0.5, 0.5);on update() if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { player.body.rotateLeft(100); } else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { player.body.rotateLeft(-100); } else { player.body.setZeroRotation(); console.log(player.angle); } player.body.thrust(400); //MOVE FOWARD CONSTANTLYTLDR: The code does the trick okey so far but: 1. The player is facing a wrong direction 2. Once you stop pressing left or right, the player will remain in whathever angle it was left, instead of "snapping" to a 45degree angle. Any idea, though, recomendation, etc. would be higly appreciated! :·3
  2. the angularVelocity property of Phaser.Physics.Arcade.Body object is a number. The api documentation said: angularVelocity :number The angular velocity in pixels per second sq. of the Body. Obviously, that is wrong, it was copied from angularAcceleration documentation and was not been corrected. I cannot understand it. In my mind, the angularVelocity should mean how many circle turns per minute, right? I'm not sure what does the angularVelocity value mean here. Can someone explain it? example code sprite.body.angularVelocity = 70;
×
×
  • Create New...