Hi!
Well, let's start with something I noticed you asked about in the other thread, namely that your ammo isn't changing properly.
First off, the manner you are detecting if the camera is on top of an object is very slow, when it would be faster to use an if statement.
not;
function check_ammo()
for i=2 to 201
cx#=camera position x():ox#=object position x(i)
cz#=camera position z():oz#=object position z(i)
for ox=ox# to ox#+11
for oz=oz# to oz#+11
if cx#=ox and cz#=oz
ammo=ammo+1
endif
next oz
next ox
next i
endfunction
But;
function check_ammo()
cx#=camera position x()
cz#=camera position z()
for i=2 to 201
ox#=object position x(i)
oz#=object position z(i)
if (cx#=>ox) and (cx#<ox+12) and (cz#=>oz) and (cz#<oz+12)
ammo=ammo+1
endif
next i
endfunction
And second, I notice that you have not made ammo a global value, so it cannot be changed in the function itself as far as the rest of the program is concenred. To do that in DBPro use the ilne of;
GLOBAL AMMO
Up near the top of the program, or in DBC make the value into an array as in;
DIM AMMO(0)
Which does the same thing. Alternatively, you could have the function return the new value of ammo, as in the above code with the ending line of;
endfunction ammo
Then your routine in the main loop would be;
ammo=ammo+check_ammo()
All fine ways of getting there...
Now I'm tired, I'll look at the rest later or let someone else pick up the ball.
Good Luck,
S.
Any truly great code should be indisguishable from magic.