Jump to content

Adding images and groups


shvalb
 Share

Recommended Posts

Hi,

 

I've started a new Project (for the first time in Phaser).

 

I'm trying to add an image background and then another images grouped together as follow:

this.group1 = game.add.group();var background = this.game.make.image(0, 0, 'lobby_bg_img');this.group1.add(background);
then in another class I do:
this.group2 = game.add.group();var scheduled_item = this.game.add.button(0,0, "scheduled_item_img", onScheduledItemClick, this);this.group2.add(scheduled_item);this.group2.x = this.game.width * 0.03;this.group2.y = this.game.height * 0.85;
This works!
 
but if instead of calling the code with 'group1' I was to do this code:
this.game.add.image(0, 0, 'lobby_bg_img');

and then call and then call the code with 'group2' - then it wouldn't work!

 
What conceptual issue I'm missing here?
 
Hope I was clear...felt like I'm more confusing than explaining :-)
 
Thanks.
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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