Hello,
I'm writing a program in witch I see my level for my FPS and just by postitioning a cone and then click store coördinates for my enemy's/other objects. It also store the number of the enemy and what kind of enemy it is. I'm pretty far, the only thing is that it doesn't want to store the correct numbers. When I read the file I stored, it gives the wrong answors. I'm sure that it is just a little mistake like I make all the time, but I can't figure out what it is.
Here's the code:
remstart
this program lets you position your enemys where ever you wan't them
author: Berry Bakker
date: 4-06-2003
company: fishsoft
remend
#include "magicload1-1.dba"
delete file "enemyposition.enm"
sync on
sync rate 0
hide mouse
autocam off
`variables
placex#=50
placez#=50
enemynumber=2000
path=100
monster=1
`load world
MagicLoad("test.mwdb",1,1,2)
`make enemycursor
make object cone 1,500
rotate object 1,180,0,0
fix object pivot 1
color object 1,rgb(255,0,0)
`position camera
position camera 0,100,0
rotate camera 30,45,0
`main
do
if upkey()=1 then z#=z#+10
if downkey()=1 then z#=z#-10
if leftkey()=1 then x#=x#-10
if rightkey()=1 then x#=x#+10
if shiftkey()=1 then y#=y#+10
if controlkey()=1 then y#=y#-10
position camera x#,y#,z#
````````````````````````````````````````````
if scancode()=59 then monster=1
if scancode()=60 then monster=2
if scancode()=61 then monster=3
````````````````````````````````````````````
if click=0
placex#=placex#+mousemovex()/2
placez#=placez#-mousemovey()/2
endif
if inkey$()="q" then inc placey#,10
if inkey$()="a" then dec placey#,10
position object 1,placex#,placey#,placez#
````````````````````````````````````````````
if mouseclick()=1 and click=0
click=1
gosub setmonster
inc numbercount
enemynumber=2000+numbercount
endif
if mouseclick()=0 then click=0
````````````````````````````````````````````
ink rgb(255,255,255),1
placex$=str$(placex#)
placez$=str$(placez#)
enemynumber$=str$(enemynumber)
text 20,20,placex$
text 20,40,placez$
text 20,60,enemynumber$
sync
loop
````````````````````````````````````````````
setmonster:
if file exist("enemyposition.enm")=1
open to read 2,"enemyposition.enm"
open to write 1,"tempenemyposition.enm"
`copy to new file
repeat
read file 2,monstera:write file 1,monstera
read file 2,enemynumbera:write file 1,enemynumbera
read file 2,xposa#:write file 1,xposa#
read file 2,placez#:write file 1,placez#
until monstera 3
`make new coördinates
write file 1,monster
write file 1,enemynumber
write file 1,placex#
write file 1,placez#
close file 1
close file 2
`final changings
delete file "enemyposition.enm"
rename file "tempenemyposition.enm","enemyposition.enm"
else
`write new coördinates
open to write 1,"enemyposition.enm"
write file 1,monster
write file 1,enemynumber
write file 1,placex#
write file 1,placez#
close file 1
endif
return
Oh yes, before I forgot, I use Magic World to make my levels, but with a simple adjustmend you can use it to
If good programmer()=1 then print "Finaly I get to the top
"