Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,709 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
laser targeting #136365
06/13/07 22:37
06/13/07 22:37
Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
tompo Offline OP
User
tompo  Offline OP
User

Joined: Mar 2007
Posts: 776
Poor village - Poland ;)
A little contribution how to make a laser (light) targeting not using a model but bmap, which looks better I think and it's more easy to do
You can add a alpha schannel or etc

If you want to see it in action look at my "space war" project in "showcase I" section LINK
all of the others ships are using this code but only player doesn't... yet
And of'course You may change vecotr to vec_for_vertex for better looking

Code:
 
var my_target[3];
function laser_targeting
{
my.passable = on; my.oriented = on; my.facing = off;
my.flare = on; my.bright = on;
while(you)
{
proc_late();
c_setminmax(me);
vec_set(my.x, you.x);
vec_lerp(my.x,you.x,my_target.x,0.5);
vec_set(temp, you.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan,temp);
my.tilt += 90;
my.scale_y = vec_dist(you.x,my_target.x) / 5; //5 is the height of the bmap
wait(1);
}
}

action gun_action
{
ent_create("your.tga",my.x,laser_targeting); //small one like 5x5
while(me)
{
vec_set(my_target, nullvector);
my_target.x = 500; //lighting range
vec_rotate(my_target, my.pan);
vec_add(my_target, my.x);
wait(1);
}
}



Last edited by tompo; 06/14/07 09:35.
Re: laser targeting [Re: tompo] #136366
06/14/07 04:24
06/14/07 04:24
Joined: May 2005
Posts: 819
U.S.
Why_Do_I_Die Offline
Warned
Why_Do_I_Die  Offline
Warned

Joined: May 2005
Posts: 819
U.S.
Looks like a very good contribution , might come in handy for my current project.


Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1