umair-khan

Members
  • Content Count

    3
  • Joined

  • Last visited

About umair-khan

  • Rank
    Newbie
  • Birthday 08/30/1994

Contact Methods

  • Website URL
    http://pixelsbyumair.blogspot.com
  • Twitter
    umair_pixie

Profile Information

  • Gender
    Male
  • Location
    Karachi,Pakistan
  1. Hi! I want to clear the whole canvas. I know there is one way by changing state, but I want to be in same state and clear whole canvas when a sprite is clicked. Something like: sprite.events.onInputDown(this.clearCanvas, this);
  2. Hi!..I know this is an old post but I have encountered a similar problem. How did you detect click on the child sprites in group? So far I am doing this but it is only detecting click on the last child in group. create() { var parent = game.add.group(); var allSprites = [ 'sprite1', 'sprite2', 'sprite3']; for (i=0; i<3; i++){ childImage = parent.create( game.world.centerX, game.world.centerY+ (i*30), allSprites); childImage.anchor.setTo(0.5, 1); childImage.inputEnabled = true; childImage.input.useHandCursor = true; } } update(){ childImage.events.onInputDown.add(changeText, this); }
  3. So I have a group, and it has three sprites. create() { var parent = game.add.group(); var allSprites = [ 'sprite1', 'sprite2', 'sprite3']; for (i=0; i<3; i++){ childImage = parent.create( game.world.centerX, game.world.centerY+ (i*30), allSprites); childImage.anchor.setTo(0.5, 1); childImage.inputEnabled = true; childImage.input.useHandCursor = true; } } How to I trigger function changeText(); when one of the child sprite is clicked. So far I have tried this method below but it only detects click on the last sprite. update(){ child.events.onInputDown.add(changeText, this); }