Jump to content

Click on emitter particles doesn't work


Recommended Posts

Hi, I am new on Phaser framework actually, but i am trying to find out.

I have an easy test game, where emitter moving from left to right, and drop particle, which is candy with 3 different state.

So i have to click on particle, and it has to change animation frame. When i click 3 time, particle have to disapear.


Here is my game code, but actually, i cannot make click event working. It looks like something wrong with my code, but i don't know where

		function getRandomInt(min, max)
		  return Math.floor(Math.random() * (max - min + 1)) + min;

		var game = new Phaser.Game('100%', '100%', Phaser.AUTO, '', { preload: preload, create: create, update: update });
		var emitter;
		function preload() {
			game.load.spritesheet('waffle', 'waffle_sprite.png', 150, 150, 3);
		function create() {
//			game.physics.startSystem(Phaser.Physics.ARCADE);
			emitter = game.add.emitter(game, 100, 100, 20);
			emitter.inputEnableChildren = true;
			emitter.onChildInputDown.add(onDown, this);
			emitter.gravity = 0;
			emitter.minRotation = -100;
			emitter.maxRotation = 100;
			emitter.setYSpeed(150, 300);
			emitter.setXSpeed(50, 50);
			emitter.makeParticles('waffle', 0);
				emitter.x=getRandomInt((game.width * 0.1), (game.width - game.width * 0.1));
				emitter.start(true, 5000, null, 1);
			}, 1000)
		function update() {
		function onDown (sprite) {

Can you please help me fix click event on every child? Thank you!

I will continue my developing after fix this issue.

Link to comment
Share on other sites

  • 1 month later...
  • 9 months later...

Hello, It doesn't work for me neither. Any clues?

Here is my emitter configuration:

	var balloonsEmitter = game.add.emitter(0, 0, MAX_NUMBER_OF_BALLOONS);
	balloonsEmitter.enableBody = true;
	balloonsEmitter.inputEnableChildren = true;
	balloonsEmitter.onChildInputDown.add(function (balloon, pointer) {
		balloon.kill(); //delete particle
	balloonsEmitter.gravity = 0;
	balloonsEmitter.makeParticles('balloonsPop', 0, 5);


Link to comment
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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...