ItsMods

Full Version: Compass
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I havent released anything for a long time, I made a code sometime ago when I was making OMA Zombies 2 to detect the position of the zombies (at your six, at your eleven, at your five....). I thought yesterday about this compass, Cool . What it does is to spin in a circle a certain icon and it will show the orientation of a certain position:

Call it like this:

Code:
self thread OrientableShader( position, icon shader, compass x center, compass y center, radius of the compass, shader width, shader height );

Example (to make it appear on the center of your screen around your crosshair, thats how it looks better):

Code:
self thread OrientableShader( self.box.origin, "compassping_enemyfiring", 0, 0, 50, 20, 20 );

self.box.origin was a position I used for testing and compassping_enemyfiring is a decent shader icon for this, remember to precache your shader in Init().

Add this code on your mod:

Code:
OrientableShader( position, shader, x, y, radius, sizex, sizey )
{
    self endon( "death" );
    self endon( "disconnect" );
    self.clocky = createIcon( shader, sizex, sizey );
    self.clocky setPoint( "", "", x, y );
    self.clocky.alpha = 1;
    while( 1 )
    {
        anglestoclock = vectorToAngles( vectorNormalize( anglesToForward( self.angles ) ) );
        anglestopos = vectorToAngles( position - self.origin );
        angle = anglestoclock[1] - anglestopos[1];
        angle += 360;
        angle = int( angle ) % 360;
        angle -= 90;
        self.clocky setPoint( "", "", x + cos( angle ) * radius, y + sin( angle ) * radius );
    wait 0.05;
    }    
}

Video:

+rep OMA
(03-22-2012, 17:12)d0h! Wrote: [ -> ]+rep OMA

Thanks, OMA . I am making a quick video.
screenies pls
(03-22-2012, 18:28)JayDi Wrote: [ -> ]screenies pls

Added video. OMA
pretty cool, now make it look like a real compas Big Grin
wow nice !
(03-23-2012, 10:56)CVD Wrote: [ -> ]pretty cool, now make it look like a real compas Big Grin

If I could rotate the shaders......Undecided