Bartuken

Members
  • Content count

    3
  • Joined

  • Last visited

  1. Different gravities for different objects

    Awesome! Thx for that. I Will implement this in my game.
  2. Hello! In Phaser ( particularly Phaser CE ) I can't find something like Wind Resistance for objects. And start thinking how to implement my own version: create(){ game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.gravity.y = 100; this.car = game.add.sprite(32, 32, "car"); game.physics.p2.enable(this.car,false); this.car.body.windResistance = 0.4; } update(){ if(this.car.body.windResistance && this.car.body.velocity.y > this.car.body.windResistance ){ this.car.body.velocity.y-= this.car.body.windResistance; } } With this I can't use big numbers for windResistance, only between 0 and 1. What do you guys think??
  3. Handle diagonal car ramp

    Greetings from a newbie in Phaser. In a 2d car game, how do you imagine a car ramp? Is there any way to draw a diagonal object and when the car object hits that start decreasing the angle and increasing the position.y? Progress! I started with Phaser.Physics.P2JS ( had to quit using Phaser.Physics.ARCADE ) Then make an sprite and assigned a Polygon: preload(){ this.load.physics('physicsData', '/app/dist/sprites.json'); } create(){ game.physics.startSystem(Phaser.Physics.P2JS); game.physics.p2.gravity.y = 50; game.physics.p2.defaultRestitution = 0.01; ramp = game.add.sprite(100, 100, 200, 100, "block"); game.physics.p2.enable(ramp); ramp.body.clearShapes(); ramp.body.loadPolygon('physicsData', 'ramp'); } My sprites.json is: { "ramp": [ { "density": 2, "friction": 0, "bounce": 0, "filter": { "categoryBits": 1, "maskBits": 65535 }, "shape": [ 200, 0 , 200, 100 , 0, 100 ] } ] } I think I got it. Any advice is good