Quote:

it is just a lot of code, cuz if you want 10 camera area's, it need 20 pointers.




Actually, this isn't true . A little known fact is that you can store pointers in an array and draw them back out into a "real" pointer to access an object, so:

Code:
define MAX_CAMERAS,20; //hold up to 20 cameras

var camera_objects[MAX_CAMERAS];
var camera_index=0;

function register_camera()
{
if(camera_index>=MAX_CAMERAS){beep; return(0);}
camera_objects[camera_index]=my;
camera_index+=1;
return(1);
}

action my_camera
{
register_camera();
// ... rest of code here
}

entity* temp_camera;

function get_closest_camera() //finds the closes camera object to PLAYER
{ //returns the pointer to the nearest camera
var i;
var best_dist;
var best_pointer;
while(i<camera_index)
{
temp_camera = camera_objects[i];//temp_camera now points to the next camera registered in the array
if(vec_dist(temp_camera.x,player.x)<best_dist)
{
best_dist=vec_dist(temp_camera.x,player.x);
best_pointer=temp_camera;
}
i+=1;
}
return(best_pointer);
}

function test_best_cam() //moves the camera to the closest camera object to the player and rotates to the same angle as the camera object.
{
temp_camera=get_closest_camera();
vec_set(camera.x,temp_camera.x);
vec_set(camera.pan,temp_camera.pan);
}
on_b = test_best_cam;



That should be enough to get you started
-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog