gzai

Members
  • Content Count

    6
  • Joined

  • Last visited

  1. @Michela Federico you can see in this example https://gamedevacademy.org/creating-a-preloading-screen-in-phaser-3/
  2. ahh, so the payload used to load only for really tiny files. I got it. If we have many scenes, is it possible to use files payload in every scene?
  3. Hi,Simple loading bar use load image after on progress, on fileprogress, and on complete : this.load.on('progress', this.onProgress, this); this.load.on('fileprogress', this.onFileProgress, this); this.load.on('complete', this.onComplete, this); this.load.image('aqua_ball'); https://phaser.io/examples/v3/view/loader/game-load-config But, when we use scene files payload, how we can get callback for progress, fileprogress, and complete to build loading bar same like the example above? const bootScene = new Phaser.Class({ Extends: Phaser.Scene, initialize: function bootScene () { Phaser.Scene.call(this, { key: 'boot', pack: { files: [ { type: 'image', key: 'aqua_ball', url: 'aqua_ball.png' }, ] } }); }, init: function (data) { ... }, preload: function () { // progress loading bar? this.load.on('progress', this.onProgress, this); this.load.on('fileprogress', this.onFileProgress, this); this.load.on('complete', this.onComplete, this); }, create: function (data) { ... }, });
  4. hello all, I had a try that source, but I can't fill that water into container object. I have a bottle and a polygon of bottle inside the bottle, when I try to this.fluid.filterArea = this.imgBottle , that water group not fill into polygon of bottle. how to fix that ? and it's that okay to startSystem 2 physics ? pyhsics BOX2D with physics P2JS Thank you preload: function () { this.load.image('bottle', 'images/bottle.png'); this.load.physics('bottlePhysics', 'scripts/bottlePhysics.json'); this.load.image('water', 'images/water.png'); }, create: function () { this.game.physics.startSystem(Phaser.Physics.BOX2D); this.game.physics.box2d.setBoundsToWorld(); this.game.physics.box2d.gravity.y = 1000; this.imgBottle = this.add.sprite( this.game.world.centerX , this.game.world.centerY - 550, 'bottle'); this.imgBottle.anchor.set(0.5); this.game.physics.box2d.enable( this.imgBottle ); this.imgBottle.body.clearFixtures(); this.imgBottle.body.loadPolygon('bottlePhysics', 'bottle', this.imgBottle ); this.game.physics.startSystem(Phaser.Physics.P2JS); this.game.physics.p2.restitution = 0.8; this.game.physics.p2.gravity.y = 1000; this.fluid = this.game.add.group(); for (var i = 0; i < 400; i++) { this.randomX = this.game.rnd.between(0, this.game.width); this.randomY = this.game.rnd.between(0, this.game.height); this.droplet = this.game.add.sprite(this.randomX, this.randomY, 'water'); // Enable physics for the droplet this.game.physics.p2.enable( this.droplet ); this.droplet.body.collideWorldBounds = true; // Add a force that slows down the droplet over time this.droplet.body.damping = 0.3; // This makes the collision body smaller so that the droplets can get // really up close and goopy this.droplet.body.setCircle(this.droplet.width * 0.3); // Add the droplet to the fluid group this.fluid.add( this.droplet ); } this.fluid.filterArea = this.imgBottle; }
  5. yes like that, but can that fluid in the bottle add a mass ( weight ) to the bottle and effect on gravity too?
  6. Hello, How to create water in the bottle, that water have a mass ( weight ) and effect on gravity? Thank you