
; Camera


	_cam = "CAMERA" CamCreate [0,0,0]
	_cam CameraEffect ["EXTERNAL", "FRONT"]
	_cam CamSetTarget camtarget
	showcinemaborder false
	
	
	#Loop
	~0.015


		; Move cam on border	
		
	_Xrate = 0
	_Yrate = 0
	_Zrate = 0	
	_rate = 80
	? MSX >= BORDERRIGHT : _Xrate=0.01
	? MSX <= BORDERLEFT : _Xrate=-0.01
	? MSY >= BORDERDOWN : _Yrate=-0.01
	? MSY <= BORDERUP : _Yrate=0.01

	_dir = (getDir camtarget)

	_lx = (getpos camtarget select 0) + _Xrate * 80 * (sin (_dir))
	_ly = (getpos camtarget select 1) + _Yrate * 80 * (cos (_dir))
	
	_lx = (getpos camtarget select 0) + (_Yrate * _rate) * sin(_dir) + (_Xrate * _rate) * cos(_dir)
	_ly = (getpos camtarget select 1) + (_Yrate * _rate) * cos(_dir) - (_Xrate * _rate) * sin(_dir)
	_lz = 0
	
	camtarget setpos [_lx,_ly,_lz]
	
	
	
		; Cam pos
	
	
	_x = 21 * (sin (_dir+180)) + (getpos camtarget select 0)
	_y = 21 * (cos (_dir+180)) + (getpos camtarget select 1)
	_z = 23
	_cam CamSetPos [_x, _y, _z]
	_cam CamCommit 0
	
	goto "Loop"