//The radar blips are found in the code of the enemy tanks:
//unrelated code was removed to make it fit better
action eTank() //the enemy tank
{
PANEL* rDot; //declare a panel pointer for the radar dot
VECTOR rSpot; //declare a vector to calculate the radar dot position
var rSpt[2]; //an array for storing the x and y components of the radar dot's position
//...sets basic parameters here, unrelated code
rDot = pan_create(NULL,9999); //create a panel for the radar dot (rDot)
set(rDot,LIGHT); //set its light flag
rDot.size_x = 8; //set its size
rDot.size_y = 8;
vec_set(rDot.blue,vector(200,0,0)); //make it blue
//...more unrelated code, its healthbar is here
while(my.health > 0)
{
//...basic movement, effects, ai, unrelated code
if(vec_dist(my.x,player.x) < 3000) //if the enemy is within 3000 units from the player, he's in radar range
{
if(!is(rDot,VISIBLE)) set(rDot,VISIBLE); //if the radar dot is not visible, make it visible
vec_set(rSpot,my.x); //set rSpot to the tank's location
vec_for_screen(rSpot,camera); //convert rSpot to screen coordinates
rSpt[0] = pSpot.x - rSpot.x; //calculate the x componant of the vector to the player
rSpt[1] = pSpot.y - rSpot.y; //calculate the y componant of the vector to the player
rDot.pos_x = radarPan.center_x + ((rSpt[0]/3000) * 64); //calculate the x position
rDot.pos_y = radarPan.center_y + ((rSpt[1]/3000) * 64); //calculate the y position
}
else
{
//beep();
if(is(rDot,VISIBLE)) reset(rDot,VISIBLE);
}
wait(1); //avoid endless loops
}
reset(rDot,VISIBLE);
ptr_remove(rDot);
//...more unrelated code
}
//and this is the code that puts the radar scope on the screen
function initScreen()
{
while(!player) { wait(1); } //wait for the player to be loaded
set(healthBar,VISIBLE | LIGHT); //turn on the health bar and allow it to be set by RGB values
set(radarPan,VISIBLE | TRANSLUCENT); //turn on the radar scope, make it transparent
radarPan.alpha = 10; //radar scope is at an alpha of 10
radarPan.scale_x *= 0.5; //radar scope is half its original size
radarPan.scale_y *= 0.5;
radarPan.center_x = 0.5 * (bmap_width(radarMap)); //move the center of the scope to the middle of the bmap
radarPan.center_y = 0.5 * (bmap_height(radarMap));
vec_set(healthBar.blue,vector(0,200,0)); //health bar is green
while(player) //while the player exists
{
radarPan.angle -= 5 * time_step * (!freeze_mode); //rotate the scope
healthBar.size_x = 190 * (player.health / player.maxHealth); //healthbar is a function of % of health
wait(1);
}
}