Jump to content

Add variables and functions to group phaser


dandorf
 Share

Recommended Posts

I created a group with the enemies on the screen. Now I would like to have each enemy hit points (some 2 others 3 others 4, etc ...). Then I thought that if there is way to make a kind of stretched groups phaser (and that he extended class could add a variable to the health points of each enemy ..?) 

 

Or do inthe Sprite class phaser .... I do not know how I should approach this. 

 

Any help or ideas? 

 

Thanks.

Link to comment
Share on other sites

Sprites already have a health property which you could probably use, though oftentimes it's better to create your own and manage it yourself. Extending Sprite is definitely the way to go. I'd definitely keep the hit points on the Sprites (or extended Sprite objects) and not the group, as the hit points count belongs to the enemies.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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