Jump to content

Search the Community

Showing results for tags 'phaser p2 TopDownVehicle'.

  • 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 1 result

  1. I've been trying to set up a top-down car game for days now. I just couldn't create car-like behaviour by myself. Then I found the TopDownVehicle class in p2's change log for version 0.7.0. The class does not seem to be implemented well in Phaser however. All over the internet I haven't found a single example case or even a mention of the class being used within Phaser. Looking at the example code found here, I came up with the following first attempt: var car = game.add.sprite(x, y, sprite, 0); // Create the vehiclevar vehicle = new TopDownVehicle(car.body);// Add one front wheel and one back wheel - we don't actually need four :)var frontWheel = vehicle.addWheel({ localPosition: [0, 0.5] // front});frontWheel.setSideFriction(4);// Back wheelvar backWheel = vehicle.addWheel({ localPosition: [0, -0.5] // back});backWheel.setSideFriction(3); // Less side friction on back wheel makes it easier to driftvehicle.addToWorld(game.physics.p2.world); // Steer value zero means straight forward. Positive is left and negative right.frontWheel.steerValue = Math.PI / 16; // Engine force forwardbackWheel.engineForce = 10;backWheel.setBrakeForce(0);Then, when I try to update the vehicle, in order to see the results, I get the following error: vehicle.chassisBody.vectorToWorldFrame is not a function(..)The error makes sense, since the vectorToWorldFrame function is located in vehicle.chassisBody.data.vectorToWorldFrame instead. I think proper implementation of this class in Phaser could help a lot of novice game designers out. Or am I missing something in the Phaser documentation? Any leads on how to best approach this?
×
×
  • Create New...