> For the complete documentation index, see [llms.txt](https://redboard.gitbook.io/r-type-1/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://redboard.gitbook.io/r-type-1/server/levels/level/entityevents.md).

# EntityEvents

This class is used to contain all events for an entity type in the level

```cpp
class EntityEvents
{
private:
    std::vector<std::pair<size_t, std::vector<size_t>>> _spawns;
    unsigned char _entity;
    std::vector<std::pair<size_t, std::vector<size_t>>>::iterator _it;
    bool _init = true;
public:
    EntityEvents(unsigned char entity);
    ~EntityEvents();
    std::vector<size_t> getSpawns(size_t currentTimecode);
    void addSpawn(size_t timecode, size_t pos);
    unsigned char getEntity() const;
    void sort();
    bool isFinished() const;
    void setInit(bool init);
};
```

### Constructor

Parameters:

* An index that represent the entity type

```cpp
EntityEvents(unsigned char entity);
```

### getSpawns

This method return a vector of size\_t that represent the list of point on y axe where entity should spawn at the timestamp given in parameter

```cpp
std::vector<size_t> getSpawns(size_t currentTimecode);
```

### addSpawn

This method append an entity in the \_spawns vector at the given timecode and on the given position

```cpp
void addSpawn(size_t timecode, size_t pos);
```

### getEntity

This method return the entity type of the class

```cpp
unsigned char getEntity() const;
```

### sort

This method is called when the file is fully pared. It sort the \_spawns vector by timecode order

```cpp
void sort();
```

### isFinished

This method check if it remain entity in the \_spawns vector

```cpp
bool isFinished() const;
```
