camera: 2 player and objects
This will help you later when you need to do multiplayer.
1st of all you need the basics
sync on:sync rate 100: hide mouse
Then you need two object okay? so we'll create 2 circles
make object sphere 1, 90:make object sphere 2, 90
the make object sphere makes a sphere, numbers it then sizes it. Now you need a camera, the default camera is camera 0 so you only need to make one camera
make camera 1 Then comes the part that makes it two player. Right now the code has the two screens ontop of eachother. you need to seperate them so you use....
set camera view 0 screen width()/2, screen height, 0, screen height this makes the camera be divided in half and placed on the left side of the screen, replace the screen width command with a zero and move the screen width to the zero and it'll be the other side. Then you make the object, store the coordinates like so
x=camera position x(0)
y=camera position y(0)
z=camera position z(0)
do
position object 1, x, y, z
since the position object 1 is in the the loop the sphere will move with the camera. You can also use xang=camera angle x(0). and then use the rotate object instead of position object.
here is the final code
sync on : sync rate 100: hide mouse
make object sphere 1, 90
make object sphere 2, 90
make camera 1
set camera view 0, screen width()/2, screen height(), 0, screen height()
set camera view 1, 0, screen height(), screen width()/2, screen height()
x= camera position x(0)
y= camera position y(0)
z= camera position z(0)
x2=camera position x(1)
y2=camera position y(1)
z2=camera position z(1)
xx=camera angle x(0)
yy=camera angle y(0)
zz=camera angle z(0)
xx*=camera angle x(1)
yy*=camera angle y(1)
zz*=camera angle z(1)
position object 1, x, y, z
rotate object 1, xx, yy, zz
position object 2, x2, y2, z2
rotate object 2, xx*, yy*, zz*
control camera using arrowkeys 0, 3, 3
if keystate(30)=1 then turn camera left 1, 3
if keystate(32)=1 then turn camera right 1, 3
if keystate(17)=1 then move camera 1, 3
if keystate(31)=1 then move camera 1, -3
sync
loop
Hope this helps!
There are only two types of people. The ones that agree with me and the ones that are wrong