Last active
August 5, 2016 04:28
-
-
Save ronjunevaldoz/c23be030b06472baf90f3c2b771bb1c2 to your computer and use it in GitHub Desktop.
libgdx ashley ecs tips & tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TIPS | |
- before removing entity be sure the components data arrays or maps are cleared | |
example 1 solution: | |
entity.removeAll(); // before using removeAll() check if the components data has arrays or maps | |
SpriteComponent sprite = Mapper.sprite.get(entity); | |
sprite.clear(); // to avoid leaving traces of unneccesary texture traces | |
entity.remove(SpriteComponents.class); | |
SpriteComponent implements Component { | |
public Array<Sprite sprite; | |
} | |
example 2 solution | |
SpriteComponent implements Componenet, Poolable { | |
@Override | |
public void reset() { | |
// clear your arrays, maps or data | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment