Spawn and camera question

Oh spawn1 & spawn2 would only spawn respective player onscreen.
If you want to spawn player offscreen or should I say couple screens from starting spot, you need to script like this:
Code:
spawn    Empty
@script
void main()
{
    void P1 = getplayerproperty(0, "entity");

    if(P1){
      changeentityproperty(P1,"position", 500, 200);
    }
}
@end_script
coords    320 460
at    0

This script will put player 1 at x = 500 and z = 200 when this level starts. I'm assuming you're using 320x240 resolution so 500 is one screen away from left edge.
You need to make similar script for player 2.
 
I thought this has been solved. But anyways, scripting custom starting position is straight forward but the camera requires extra work.
Try this:
Code:
spawn    Empty
@script
void main()
{
    void P1 = getplayerproperty(0, "entity");
    int Width = openborvariant("levelwidth");
    int Screen = openborvariant("hResolution"); // Get screen width
    int x = 600; // player 1's starting x coord
    int Cam;

    if(x > Width){
      x = Width;
      Cam = Width - Screen;
    } else if(x > Width - Screen){
      Cam = Width - Screen;
    } else if(x < 0){
      x = 0;
      Cam = 0;
    } else {
      Cam = x - Screen/2;
    }

    if(P1){
      changeentityproperty(P1, "position", x, 200);

      changeopenborvariant("xpos", Cam);
    }
}
@end_script
coords    320 460
at    0
 
Back
Top Bottom