getEntityByName method

GameEntity? getEntityByName(
  1. String name
)

Returns an entity by the given name. If no game entity is found, null is returned. This method should be used once (e.g. at {@link GameEntity#start}) and the result should be cached for later use.

Implementation

GameEntity? getEntityByName(String name ) {
	final entities = this.entities;

	for ( int i = 0, l = entities.length; i < l; i ++ ) {
		final entity = entities[ i ];
		if ( entity.name == name ) return entity;
	}

	return null;
}