Posted: 7th Dec 2003 21:44
I have just had an idea of using the mouse to control a plain on the matrix. the only media you need is one for the target/plain (yellow?) and a grass one.

Tell me wat you think and see if it works if it doesnt could anyone have a look at fixing it?

+ Code Snippet
``````````````````````````````````````````````````````
``````````````````````````````````````````````````````
````````````````````STRATERGY GAME````````````````````
``````````````````````````````````````````````````````
``````````````````````````````````````````````````````
autocam off

rem make matrix
make matrix 1,5000,5000,50,50
load bitmap "grass2.bmp",4
get image 4,0,0,256,256
delete bitmap 4
prepare matrix texture 1,4,2,2

rem position camera
position camera 0,125,0
point camera 100,5,100
set camera fov 90
camx=camera position x()
camy=camera position y()
camz=camera position z()


rem make a building
make object box 1,25,77,25
position object 1,250,37.5,250
clone object 1,2
position object 2,250,37.5,350
clone object 1,3
position object 3,350,37.5,350
clone object 1,4
position object 4,350,37.5,250
make object box 5,100,10,100
position object 5,300,25,300
clone object 5,6
position object 6,300,65,300

rem make a target which is locked to mouse
make object plain 7,50,50
xrotate object 7,90
position object 7,150,1,150
load bitmap "gridyellow.bmp",5
get image 5,0,0,256,256
delete bitmap 5
texture object 7,5
tarx=object position x(7)
tary=object position y(7)
tarz=object position z(7)


do

gosub controlcamera

gosub controlmouse


sync


loop

```````````GOSUBS
rem control camaera
controlcamera:
camx=camera position x()
camy=camera position y()
camz=camera position z()
if upkey()=1 then position camera camx+7,camy,camz+7;position object 7,tarx+7,tary,tarz+7
if downkey()=1 then position camera camx-7,camy,camz-7;position object 7,tarx-7,tary,tarz-7
if leftkey()=1 then position camera camx-7,camy,camz+7;position object 7,tarx-7,tary,tarz+7
if rightkey()=1 then position camera camx+7,camy,camz-7;position object 7,tarx+7,tary,tarz-7
if controlkey()=1 then set cursor 0,0; print "  x>>>",camx,"  y>>>",camy,"  z>>>",camz
camx=camera position x()
camy=camera position y()
camz=camera position z()
return

rem control mouse
controlmouse:
mosmovx=mousemovex()
mosmovy=mousemovey()
mosmovz=mousemovez()
tarx=object position x(7)
tary=object position y(7)
tarz=object position z(7)
if mosmovx=mosmovx+1 then position object 7,tarx+50,tary,tarz+50
if mosmovx=mosmovx-1 then position object 7,tarx-50,tary,tarz-50
if mosmovy=mosmovy+1 then position object 7,tarx+50,tary,tarz+50
if mosmovy=mosmovy-1 then position object 7,tarx-50,tary,tarz-50
tarx=object position x(7)
tary=object position y(7)
tarz=object position z(7)
mosmovx=mousex()
mosmovy=mousey()
mosmovz=mousez()
return



Rich
Posted: 8th Dec 2003 19:13
is any one out there???
Posted: 9th Dec 2003 3:00
You like lord of the rings, me too. I'm also trying to make a stragegy game and have been thinking about a similar if not the same problem. What exactly are you trying to accomplish? Are you trying to select a point (or object) on a matrix with the mouse? That's my problem.
Posted: 10th Dec 2003 0:23
If you guys want help, search rts in the code snippits
Posted: 10th Dec 2003 9:10
or check this thread:
http://www.dannywartnaby.co.uk/rgt/index.php?board=18;action=display;threadid=1360
Posted: 11th Dec 2003 7:15
hey simpro
firstly when you used 'clone object' you mixed up the parameters. the new object that is being created is the first parameter and the second parameter is the source object or the object that is being cloned. so when i tried it it didnt really do anything. that black plain stayed in the middle of the screen and moved with the camera.
i cant really be bothered writing anymore right now but im working on an rts at the moment and i have mastered several aspects of it so if you or anyone else want any help in selecting a point on the matrix with the mouse or some other aspect of an rts, email me at teepee47_@hotmail.com