Function for a radar in 3 by Jess T27th Sep 2003 9:28
|
---|
Summary This Function will display a 2D box radar of your main character and all other objects on the matrix... It will be in the top right corner of the screen and uses circles to represe Description Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com `**************************************************************** `*** Radar Function *** `*** By JessTicular *** `*** 27th Sept 2003 *** `*** www.JessTicular.tk *** `*** Give credit where it's due. Thanks *** `**************************************************************** FUNCTION radar_disp() `radar box you can change these values to suit your needs INK RGB(0,255,0),0 `top LINE (SCREEN WIDTH()-100),0,SCREEN WIDTH(),0 `bottom LINE (SCREEN WIDTH()-100),100,SCREEN WIDTH(),100 `left LINE (SCREEN WIDTH()-100),0,(SCREEN WIDTH()-100),100 `right LINE (SCREEN WIDTH()-1),0,(SCREEN WIDTH()-1),100 INK RGB(255,0,0),0 `Change the 100 to the heighest number of object you have. FOR a = 1 TO 100 `This if assumes your character is object number 1. `It gives your object's circle a larger radius and a different colour. IF a = 1 radius# = 2 INK RGB(255,0,0),0 ELSE radius# = 1 INK RGB(100,100,255),0 ENDIF REMSTART Ok... firstly it checks to see if this object number exists. The circle is positioned CIRCLE x,y,radius. The x value here is the x value in 3D space, hence OBJECT POSITION X(a), the y value is the z value in 3D space, hence OBJCET POSITION Z(a). (OBJECT POSITION X(a)/100) is done because: In my game, i used a matrix of 10000x10000 Because the box for the radar is only 100x100, the values to position them, had to be < 100 Since OBJECT POSITION X(a) MUST BE < 10000 (otherwise it'd be off the matrix) then (OBJECT POSITION X(a)/100) MUST BE < 100 If you are using a matrix of size, 500x500, simply make the code (OBJECT POSITION X(a)/5) or for matrix 65000x65000 make it (OBJECT POSITION X(a)/650) etc. etc... This will give you your value < 100 REMEND IF OBJECT EXIST(a)=1 CIRCLE ((SCREEN WIDTH()-101)+(OBJECT POSITION X(a)/100)),(100 - (OBJECT POSITION Z(a)/100)),radius# ENDIF NEXT a ENDFUNCTION |