# Thinking about how to store objects in a game

**URL:** <https://forum.kirupa.com/t/thinking-about-how-to-store-objects-in-a-game/282190>\
**Category:** Uncategorized\
**Created:** [February 18, 2009, 7:36pm UTC](https://forum.kirupa.com/t/thinking-about-how-to-store-objects-in-a-game/282190 "2009-02-18T19:36:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BeerOclock](https://avatars.discourse-cdn.com/v4/letter/b/fbc32d/32.png) [@BeerOclock](https://forum.kirupa.com/u/BeerOclock)\
**Post date:** [February 18, 2009, 7:36pm UTC](https://forum.kirupa.com/t/thinking-about-how-to-store-objects-in-a-game/282190/1 "2009-02-18T19:36:58Z")

</div>

Suppose I have a list of 100 enemies on the stage like this (pseudocode):

```auto

// init:
enemies = new Array();
for (i=0; i<100; i++) {
 temp = new Enemy(a, b, c);
 stage.addChild(temp);
 enemies.push(temp);
}

```

Now enemies is an array of all the enemies, so I can update all of their positions, and other properties, each frame. Is this a good way to do things? Because I just realized that I’m storing each enemy twice: One time in enemies Array and one time in stage.children. Maybe I should get rid of the enemies Array altogether, and just use stage.getChildAt() to update the enemies? Or am I missing something.
