I understand all of the functions in the code below but I have a question regarding the ENTITY pointer.


I understand that the function camera_follow is assigned to ENTITY* ent but how does Gstudio know which entity is ent? There are multiple entities, why does the camera follow your wizard and not the other?

Code:
function camera_follow(ENTITY* ent)
{
	while(1) 
	{
		vec_set(camera.x,vector(-150,10,50));  // camera position relative to the player      
		vec_rotate(camera.x,ent.pan); // rotate the camera position with the player
		vec_add(camera.x,ent.x);      // add player position
		vec_set(camera.pan,vector(ent.pan,-10,0)); // look in player direction, slighty down      
		wait(1);
	}
}