Sign in to follow this  

Particle collision

Recommended Posts

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.config.positionY, this.config.maxParticles)
    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)
// 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.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?


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.