Skip to content

Cs2dEntities

Magnus edited this page Dec 9, 2017 · 2 revisions

The Cs2dEntities Object

The Cs2dEntities object allows modifying, removing and creating entities

to add new entities, simply create the entity and configure it, then add it to this object

Info_T tSpawn = new Info_T();

tSpawn.setLocation(2, 2);

cs2dEntities.addEntity(tSpawn);

a list of all entities can be seen here Cs2d Entity List

to get a list of all entities on the map you can use getEntities() however, getting all entities like this has some disadvantages, the type returned will be a List, each entity would have to be casted into the correct type

Cs2dEntity entity = ... Env_Building building = (Env_Building) entity;

a better way to read specific entities from map would be

List<Env_Building> buildings = cs2dEntities.getEntities(Env_Building.class);

this ensures you get all entities of a specific type

Clone this wiki locally