So with some help from the RTS help file I found on here, I've been trying to set up some working bits for a real time strategy game. So I've got the camera controls working, and i wrote the function for making a unit. For some reason, whenever I run that function, or use the MAKE OBJECT _____ where _____ is cube, sphere, whatever, the camera centers on it and it screws up my camera view. I tried setting the camera to camera 2 instead of camera 1 right before running the make command, and then changing it back after the object is made, with the hope that it would center camera 2 on the object and leave camera 1's view unscathed, to no avail.
do
if upkey() = 1
cameraxv# = camera position x(1) + .1
camerayv# = camera position y(1)
camerazv# = camera position z(1)
position camera 1, cameraxv#, camerayv#, camerazv#
targetx# = targetx# + .1
point camera 1,targetx#,targety#,targetz#
endif
if downkey() = 1
cameraxv# = camera position x(1) - .1
camerayv# = camera position y(1)
camerazv# = camera position z(1)
position camera 1, cameraxv#, camerayv#, camerazv#
targetx# = targetx# - .1
point camera 1,targetx#,targety#,targetz#
endif
if leftkey() = 1
cameraxv# = camera position x(1)
camerayv# = camera position y(1)
camerazv# = camera position z(1) + .1
position camera 1, cameraxv#, camerayv#, camerazv#
targetz# = targetz# + .1
point camera 1,targetx#,targety#,targetz#
endif
if rightkey() = 1
cameraxv# = camera position x(1)
camerayv# = camera position y(1)
camerazv# = camera position z(1) - .1
position camera 1, cameraxv#, camerayv#, camerazv#
targetz# = targetz# - .1
point camera 1,targetx#,targety#,targetz#
endif
loop
function make(x,y,n,unittype)
index = array count(units(0))
make object sphere n, 1
position object n, x, y, 0
array insert at bottom units(0)
units(index).object = n
units(index).action.isMoving = 0
units(index).action.isAttacking = 0
units(index).action.isSelected = 0
units(index).isHarvesting = 0
units(index).group = -1
units(index).unit = unittype
units(index).life = characterType(unittype).maxLife
`units(index).stage = ANIMATE_IDLE
units(index).tempX = -1
units(index).tempZ = -1
unitcount(0) = unitcount(0) + 1
endfunction
Can anyone help me here?