Jump to content

When add sprite to two groups events.onInputDown does not work?


Recommended Posts

Hello, everyone.

I am using Phaser 2.8.3

Basically I want to add a sprite to two groups. In my game I want three columns so I have three column groups.

this.leftColumn = game.add.group();
this.middleColumn = game.add.group();
this.rightColumn = game.add.group();


Later I add buttons into these groups

this.spawnRateButton = [];
for(var i=0;i<3;i++){
    this.spawnRateButton[i].inputEnabled = true;


However here comes my problem. I want these columns to be scrollable, so I have to utilize this https://github.com/trueicecold/phaser-scrollable . 

this.scroller = game.add.existing(new ScrollableArea(x, y, width, height, {horizontalScroll: false})); 

The scrolling works, however, the events.onInputDown of the spawnRateButtons do not. I click the buttons and nothing happens. When I take away the scroller everything works fine except for the scrolling, of course. When I add the sprites individually to the scroller it doesn't work either.


I am guessing this is because I am trying to add the sprites to two groups? Is there a correct way to do this?

Link to comment
Share on other sites


  • Recently Browsing   0 members

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