-
Notifications
You must be signed in to change notification settings - Fork 1
Entity
An entity is an object that is defined in a level that can run code. Entities are defined in the levels entities.json file. Each entity has a "name" tag that is used for identification and a "type" tag that tells the game code what kind of object to instantiate to run the appropriate code. At runtime, the JSON data is converted into python dictionaries and lists which are then converted into objects. Each object has a tick() function that runs every time the game loops through the main loop. This tick() function may operate on custom data found in the entities.json file, so although the code itself is not customizable, a lot of custom interactive content can arise just by editing JSON values.
Not all entities have a tick() function that does something. Sometimes, we don't want the entity's code to run unless some specific event occurs. In this case we replace the code in tick() with a pass statement that just tells python not to run any code. Instead, we use a trigger() method.
THIS TUTORIAL IS WORK IN PROGRESS