For whatever reason, the correct Y coordinate of your shot is not being returned (maybe using 'move object' has something to do with it). Some comments:
1. You have coded it so that you have to wait for the shot to get all of the way across the screen before you can move; not a good idea. Your code should allow things to keep moving during each loop.
2. What's with using camera 1? Why not just use camera 0 (default)? With your code, you actually have both cameras working. If you move up toward the top it shows object #1 in two places.
3. Sync rate 0 is good when you want to know how fast something will run or to make comparisons. You should choose a sync rate that will keep the game pace at a reasonably close constant. Otherwise it will fly on the best machines and drag on the slow ones. It depends on the game as to what that is. Normally I code in the 40 - 60 FPS range.
I have revamped your code to give you something to work with. Here it is:
sync on
sync rate 60
hide mouse
autocam off
make object box 1,30,30,30
position object 1,0.0,0.0,0.0
position camera 125.0,0.0,-200.0
point camera 125.0,0.0,0.0
global missx# as float : global missy# as float
global missile : global MissSpeed# as float
global scr_wid as integer
global mx# as float : global my# as float : global mz# as float
mx#=0.0 : my#=0.0 : mz#=0.0
scr_wid=screen width()
missSpeed#=8.0
do
if upkey() and my#<94.0 then my#=my#+2.0 : position object 1,mx#,my#,mz#
if downkey() and my#>-94.0 then my#=my#-2.0 : position object 1,mx#,my#,mz#
if spacekey() and missile=0 then fire()
if missile=1 then MoveMissile()
sync
loop
show mouse
end
function fire()
make object box 2,10,10,10
position object 2,mx#,my#,mz#
missx#=mx# : missy#=my#
missile=1
endfunction
function MoveMissile()
missx#=missx#+MissSpeed#
position object 2,missx#,missy#,mz#
if object in screen(2)=0
missile=0
delete object 2
endif
endfunction
You should be able to add multiple missiles fairly easily.
You will need to either set the screen width and height or will have to look at the height to determine the upper lower limits for object #1. With my current screen rez, 96.0/-96.0 worked, but this will not always be the case.
Best of luck,
LB