Spawning and entities
|
One of the things I’ve made this week, week 3 or 4, is to have the data about characters and entities be loaded from files, and to able to be placed in the tilemap editor. It’s otherwise been mostly small fixes and et cetera. These are some of the things which wasn’t implemented in the prototype, except for the tilemap editor. The placing where the entities appear are called spawns, which they usually are called in games. The spawn data about what entitets are spawned and where they are spawned, are included in the tilemap file, while the data about the entity types are saved as separate files for each entity type. The data is stored as JSON files. Adrian had implemented loading of the tilemap from a JSON file before I began with this, so I loaded and saved the JSON files using the same way. The type of entity is selected from a drop down menu in the tilemap editor, except for the first item in the drop down menu, which is for editing the tilemap, and edits what is solid and what is not solid. The entities are placed by clicking on the tiles on the tilemap in the tilemap editor. One of the entity types loaded from the files is player spawn points, the places for the players to spawn are chosen at random between these positions. It is worth noting that we have two ways of having entity types. We for example have ‘Character’ which is a class inherited from Entity, and we also have the specific enemies and player classes which are of the ‘Character’ class type, and are saved as JSON files. These data are structs of ‘EntityData’ which exists on the ‘Entity’ class. |