FlxGroup vs Array

  • Hi! HaxeFlixel newbie here. I was just wondering exactly when to use FlxGroup over a regular array. I'm currently doing that only when I know that I can make use of some API function that uses a FlxGroup - what are some other usage tips?

  • FlxGroup can be added to other groups/states, so update() and draw() are called on all the members of the group with exists == true. Be careful, adding to two groups can lead to update() called twice resulting in 2x simulation speed (can be solved by marking the group active = false).

    Use arrays when you don't want to update/draw sprites, or they are updated/drawn from other group already.

    And also, as you said, use groups when APIs demand FlxGroup, like for object recycling or collision.

  • This post is deleted!

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.