RollinSafary

Members
  • Content Count

    10
  • Joined

  • Last visited

  1. RollinSafary

    Load from URL

    Hey guys I'm trying to load image from url addreess this.load.image(key, url, xhrSettings) this.load.start() and I'm getting error
  2. RollinSafary

    spirte bounds position wrong

    by default, Phaser.GameObjects.GameObject, from which extends other game objects in Phaser 3, has origin set to 0.5, but the graphics hasn't origin, so in the same position you'll see different bounds
  3. RollinSafary

    How to remove matter colliders

    ``` setColliders (x, y, side, index) { // collider a this.colliderA = this.scene.matter.add.circle(x - side * 150, y, 7, { label: 'collider_a', isStatic: true, }) // collider b this.colliderB = this.scene.matter.add.circle(x, y, 7, { label: 'collider_b', isStatic: true, }) // collider basket this.colliderBasket = this.scene.matter.add.rectangle( x - side * 73, y, 120, 30, { label: `Basket${index}`, isStatic: true, isSensor: true, }, ) } ``` which function will remove them ?
  4. RollinSafary

    How to know the current fps in phaser 3?

    using in-game fps meter can cause decreasing game fps, so i suggest you to use your browser fps meter for Google Chrome here is the link https://developer.chrome.com/devtools/docs/rendering-settings
  5. RollinSafary

    Changing emitter textures

    to change particle image via makeParticles() method you'll need to restart it, you can see the method, how we done it in our plugin https://github.com/koreezgames/phaser-particle-editor - this is editor link, here you can create you emitter https://github.com/koreezgames/phaser-particle-editor-plugin - this is plugin link, here are all emitter specific methods, so you can see how we do that (ES6)
  6. RollinSafary

    Tweening particles

    share an example, please
  7. RollinSafary

    Particle collision

    thanks
  8. RollinSafary

    Particle collision

    i'm trying to change collision option after emitter had started but i can't create () { // --------------------------------CONFIG-------------------------------- this.config = { 'followCursor': false, 'mouseClick': false, 'gravityX': 0, 'gravityY': 0, 'positionX': 960, 'positionY': 540, 'maxParticles': 50, 'particleKey': 'particle', 'frames': 1, 'quantity': 5000, 'collide': false, 'collideWorldBounds': false, 'scaleToX': 1, 'scaleToY': 1, 'scaleRate': 0, 'scaleEase': Phaser.Easing.Linear.None, 'scaleYoyo': false, 'alphaMin': 1, 'alphaMax': 0, 'alphaRate': 0, 'alphaEase': Phaser.Easing.Linear.None, 'alphaYoyo': false, 'rotationMin': 0, 'rotationMax': 0, 'bounceX': 0, 'bounceY': 0, 'angularDrag': 0, 'particleMinSpeedX': -300, 'particleMinSpeedY': -300, 'particleMaxSpeedX': 300, 'particleMaxSpeedY': 300, 'emitterSpeedX': 200, 'emitterSpeedY': -200, 'lifespan': 500, 'particleFrequency': 250, 'particleQuantity': 500 } // --------------------------------EMITTER-------------------------------- this.emitter = this.game.add.emitter(this.config.positionX, this.config.positionY, this.config.maxParticles) this.makeParticles() this.emitter.minParticleSpeed.setTo(this.config.particleMinSpeedX, this.config.particleMinSpeedY) this.emitter.maxParticleSpeed.setTo(this.config.particleMaxSpeedX, this.config.particleMaxSpeedY) this.emitter.gravity.x = this.config.gravityX this.emitter.gravity.y = this.config.gravityY this.emitter.setScale(this.config.scaleFromX, this.config.scaleToX, this.config.scaleFromY, this.config.scaleToY, this.config.scaleRate, this.config.scaleEase, this.config.scaleYoyo) this.emitter.setAlpha(this.config.alphaMin, this.config.alphaMax, this.config.alphaRate, this.config.alphaEase, this.config.alphaYoyo) this.emitter.angularDrag = this.config.angularDrag this.emitter.setRotation(this.config.rotationMin, this.config.rotationMax) this.emitter.bounce.setTo(this.config.bounceX, this.config.bounceY) this.emitter.setXSpeed(this.config.emitterSpeedX) this.emitter.setYSpeed(this.config.emitterSpeedY) this.startEmitter() // here I want to change both collision options from false to true, and to make it work with new collision options } startEmitter () { this.emitter.start(false, this.config.lifespan, this.config.particleFrequency, this.config.particleQuantity, false) } makeParticles () { this.game.add.emitter(this.config.positionX, this.config.positionY, this.config.maxParticles) this.emitter.makeParticles(this.config.particleKey, this.config.frames, this.config.quantity, this.config.collide, this.config.collideWorldBounds) } Can anybody help me in this?
  9. RollinSafary

    How to kill a sprite after going out of bounds

    try this way <script type="text/javascript"> var game = new Phaser.Game(1040, 450, Phaser.AUTO, '', { preload: preload, create: create, update: update }); var platforms; var player; var bot; function preload(){ game.load.image('sky','assets/rpg-bg.png'); game.load.spritesheet('player','assets/player-walk.png', 87,125); game.load.spritesheet('player-attack','assets/player-shot.png', 113, 132); game.load.image('player-death','assets/player-death.png'); game.load.spritesheet('bot','assets/bot.png', 112, 141); } function create(){ game.physics.startSystem(Phaser.Physics.ARCADE); // Backgrounds game.add.sprite(0, 0, 'sky'); bot = game.make.sprite(1000, game.world.height, 'bot'); //changed from game.add to game.make game.physics.arcade.enable(bot); bot.body.gravity.y = 100; bot.anchor.setTo(0.5, 0.5); bot.body.collideWorldBounds = true; bot.body.checkCollision.none = true; bot.animations.add('run'); bot.animations.play('run', 10, true); bot.checkWorldBounds = true; bot.events.onOutOfBounds.add(killBot, this); game.add(bot); //added to game // Player player = game.add.sprite(32, game.world.height, 'player'); game.physics.arcade.enable(player); player.body.bounce.y = 0.1; player.body.gravity.y = 100; player.body.collideWorldBounds = true; player.animations.add('run'); player.animations.play('run', 10, true); } function update(){ // Bot Movement bot.body.velocity.x = -150; } function killBot(bot){ bot.parent.remove(bot); } </script>
  10. RollinSafary

    Tweening particles

    Hey all. I want to apply color tweening to particles, but i don't know how, can anybody help me in this? thanks in advance