1 registered members (henrybane),
1,499
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
free Alien VS Predator radar code
#62243
01/18/06 14:09
01/18/06 14:09
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
OP
Senior Expert
|
OP
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Hello. A simple contribution : short video Download !It works well for 'unlimited' (radar) objects using pan_create. Have fun ! gOmO_3 EDIT : Adjust the radar's range by changing the make_scan.z value : function init_radar { panel_radar.visible = on; make_scan.z = 2000; // radar's range panel_radar.pos_y = screen_size.y-198; shadow_threshold = 30; } If you wanted constant radar elements, you should use this code : Code:
/////////////////////////////////////////////////////////////////////////////////// // Radar code for unlimited objects // by Felix Pohl aka gOmO_3 | 2006 // no credit required, though I would be grateful // how to use : call "init_radar" once (for example in // your main function) and assign "g3_handle_radar" to // your actions. don't forget to include this wdl ! // Predator model : Kai Kieschnick (soulreaver2@gmx.de) ////////////////////////////////////////////////////////////////////////////
entity* ent_temp;
var make_scan;
bmap bmp_radar = <radar.tga>; bmap bmp_radar_enemy = <enemy.tga>;
font fnt_dist = "Porky's",1,40;
panel panel_radar { pos_x = 32; pos_y = 570; bmap = bmp_radar; flags = refresh; layer = 2; }
panel* pan_temp;
function init_radar { panel_radar.visible = on; make_scan.z = 2000; // radar's range panel_radar.pos_y = screen_size.y-198; shadow_threshold = 30; }
function g3_handle_radar { while(me) { if(vec_dist(my.x,camera.x) < make_scan.z) { pan_temp = pan_create("bmap = bmp_radar_enemy; flags = visible,refresh,filter;",4); my.skill92 = handle(pan_temp); while(vec_dist(my.x,camera.x) < make_scan.z) { pan_temp = ptr_for_handle(my.skill92); vec_set(temp,camera.x); vec_sub(temp,my.x); vec_to_angle(my.skill97,temp); my.skill98 = vec_dist(my.x,camera.x); pan_temp.scale_x = 0.85-my.skill98/(make_scan.z*1.5); pan_temp.scale_y = pan_temp.scale_x; pan_temp.pos_x = panel_radar.pos_x+96-my.skill98/(make_scan.z*1.2/100)*sin(camera.pan-my.skill97)-16*pan_temp.scale_x; pan_temp.pos_y = panel_radar.pos_y+96+my.skill98/(make_scan.z*1.2/100)*cos(camera.pan-my.skill97)-16*pan_temp.scale_x; wait(1); } pan_temp = ptr_for_handle(my.skill92); pan_remove(pan_temp); } wait(1); } }
Last edited by gOmO_3; 01/18/06 14:19.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: free Alien VS Predator radar code
[Re: PHeMoX]
#62247
01/19/06 01:00
01/19/06 01:00
|
Joined: Jan 2003
Posts: 1,142 California
Daedelus
Senior Developer
|
Senior Developer
Joined: Jan 2003
Posts: 1,142
California
|
@Gomo_3: Awesome job! @Phemox: I don't know how the lines would be drawn like you want 'em, but have you looked at Locoweed's Minimap/radar scripts? Maybe the minimap would be a good start for this? http://www.thekidgame.com/Locoweed3DGS/misc.htm
|
|
|
Re: free Alien VS Predator radar code
[Re: Daedelus]
#62248
01/19/06 01:20
01/19/06 01:20
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
This radar code is great, I've changed somethings so it works as a regular radar, usable in my top-down game (i mean, camera indepent, player dependent, just changed 3 words in the code ) and it works great, I'm using A6.4 com btw... @Daedelus: Thanks for the link to Locoweed's site, I think that his radar code will be pretty useful indeed for what I had in mind, thanks. I've also seen some other interesting topics there, like a simple AI example, I'm going to check those out asap... Cheers
|
|
|
Re: free Alien VS Predator radar code
[Re: Superku]
#62250
01/19/06 17:30
01/19/06 17:30
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Mmm, after some fiddling with this code, and changing it for my needs, there's something strange happening. At the edges of my radar, when the enemies are just getting in range (or just out of range) the dots get like twice the size, instead of being really small, or invisible. Anyone have an idea why this happens? Like I said in one of my previous posts, only things I've changed is camera.x into player.x, wherever the camera was involved. It must be the math when certain values get past some range, it's kinda confusing, because it's working fine, except this size blow-up when they are at the range area of the radar... Code:
_____________ |O . . | | * | | * * * | | . . | |O_____O_____|
The zeros are my 'problem' , I want them either invisible, or super small sized, not twice the normal size ... EDIT: Nevermind, I've got it solved ... I've just added ; Code:
if(pan_temp.pos_x - rader.pos_x < 25){break;} if(pan_temp.pos_y - rader.pos_y < 25){break;} if(pan_temp.pos_x - rader.pos_x > 100){break;} if(pan_temp.pos_y - rader.pos_y > 100){break;} Cheers
Last edited by PHeMoX; 01/19/06 18:08.
|
|
|
|