hello,I am having trouble with finding a code to move an object
here is the code
make matrix 1,1000,1000,50,50
randomize matrix 1,0
update matrix 1
LOAD IMAGE "media\tank2.bmp",1
LOAD IMAGE "media\gt.jpg",2
LOAD IMAGE "media\tracks.bmp",3
LOAD OBJECT "media\H-Tank 2.3ds",1
Position object 1,(50),(0),(20)
Prepare matrix texture 1,2,2,2
o = pick object(mouseX(), mouseY(), obj.ground, obj.ground)
x# = camera position x(0) + get pick vector x()
y# = camera position y(0) + get pick vector y()
z# = camera position z(0) + get pick vector z()
position object obj.current, x#, y#, z#
Sync on
sync rate 60
ink rgb(50,255,50),rgb(0,0,0)
Do
Gosub Mouse
Gosub Controls
Sync
Loop
Mouse:
If Mouseclick()=1
If MouseDown=1
MouseDown=2
endif
if MouseDown=0
MouseDown=1
StartingXSelect=MouseX()
StartingYSelect=MouseY()
endif
else
MouseDown=0
endif
If MouseDown>0
line StartingXSelect,StartingYSelect,StartingXSelect,MouseY()
line StartingXSelect,MouseY(),MouseX(),MouseY()
line MouseX(),StartingYSelect,Mousex(),MouseY()
line StartingXSelect,StartingYSelect,Mousex(),StartingYSelect
ink rgb(50,255,50),rgb(0,0,0)
If StartingXSelect>MouseX()
TestX=StartingXSelect
Test2X=MouseX()
else
TestX=MouseX()
Test2X=StartingXSelect
endif
If StartingYSelect>MouseY()
TestY=StartingYSelect
Test2Y=MouseY()
else
TestY=MouseY()
Test2Y=StartingYSelect
endif
if TestX>Object Screen X(1)
if Test2X<Object Screen X(1)
if TestY>Object Screen y(1)
if Test2Y<Object Screen y(1)
ink rgb(255,0,0),rgb(0,0,0)
endif
endif
endif
endif
endif
return
Controls:
if upkey()=1 then inc Z,1
if leftkey()=1 then dec X,1
If rightkey()=1 then inc X,1
If downkey()=1 then dec Z,1
Position camera X,50,Z
Point camera X,0,Z+50
return
if someone can help me I would like that