Entities
UPDATE! : Please check out the next page, Smart Entities. They offer more automation where you literally just have to create an object and it is created for everyone else and the variables are synced up.
Entities are special objects that 'belong' to a player. This can be used to represent things that the player owns, like a gun, or bullets fired by the player.
Similar to our previous global.sharedProperties and oOtherPlayer we have oMyEntity and oOtherPlayerEntity.
This means that clients can have Entities that belong to them. Like my client can have an Entity representing a 'Gun'.
This variable being updated in an instance of oMyEntity
The need for Entities
Technically all information can somehow be encoded and stored in the basic global.sharedProperties but this can get difficult to manage if you have a lot of stuff.
For example, if you want to talk about fast-moving bullets, you'll have to keep track of every individual bullet and add it and remove it from global.sharedProperties and this can be a tedious process.
Instead you can make an oMyEntity and use it as the bullet.
It will automatically appear on other people's screens as an instance of oOtherPlayerEntity, and you'll have to do something similar here to make it move.
Last updated