import {Container} from '@pixi/react';

import Sprite from './sprite.jsx';

export default function Entities({entities, x, y}) {
  const sprites = [];
  for (const id in entities) {
    const entity = entities[id];
    if (!entity.Position || !entity.Sprite) {
      continue;
    }
    sprites.push(
      <Sprite
        entity={entity}
        key={id}
      />
    );
  }
  return (
    <Container x={x} y={y}>
      {sprites}
    </Container>
  )
}