Get the handle of type:
Get the type by handle:
Someone gave a good tip using NameEntity with Handle(), when creating type which contains entity.
Simple example:
Now, instead of looping through the whole typelist searching for a certain entity (like one which got collisioned with), you just get the typehandle from the entityname and use Object to get the type:
TypeHandle% = Handle(Type.Type)
Get the type by handle:
Type.Type = Object.Type(TypeHandle%)
Someone gave a good tip using NameEntity with Handle(), when creating type which contains entity.
Simple example:
;Create an enemy and return the type Function CreateEnemy.Enemy(Mesh) E.Enemy = New Enemy E\Entity = CopyEntity(Mesh) NameEntity E\Entity, Handle(E.Enemy) Return Enemy.Enemy
Now, instead of looping through the whole typelist searching for a certain entity (like one which got collisioned with), you just get the typehandle from the entityname and use Object to get the type:
;Find the enemy type with the entity Function FindEnemy.Enemy(Ent%) Local TypeHandle% = EntityName(Ent%) Enemy.Enemy = Object.Enemy(TypeHandle%) If Enemy<>Null Return Enemy.Enemy ;Or just Return Enemy.Enemy, remember to check for null-type End Function