Re: Some scripts from Grikarugun.
Psuedo solidity, coming soon. Useful for moving walls that can crush the player, multiple paths (decide quick!!) in scrolling shooters, and much much more.
In the meanwhile, these fun little things are used in level 2 by the "tank like" enemies and a wip 'no-tile enemy' boss. Aptly named "Degree_Buster, and Degree_Buster_Buster". Anyone get the reference?
The first will take a degree, modify it so that it is ten degrees closer to target x,y, and finally return that modified number.
The second will take a radian value, compare that with target x,y, and return that value with a difference of 1/36th.
You gotta love flying tanks. :D
Code:
int Degree_Buster(int targetx, int targety, int originx, int originy, int firing_degree){
int atan = ArcTan(targetx-originx,targety-originy)*(180/PI);
while(atan<0)atan+=360;
while(firing_degree<0)firing_degree+=360;
while(firing_degree>360)firing_degree-=360;
if(Abs(firing_degree-atan)>180){
if(atan>firing_degree)return (firing_degree-10);
else return (firing_degree+10);
}
else if(Abs(firing_degree-atan)>10){
if(atan>firing_degree)return (firing_degree+10);
else return (firing_degree-10);
}
else return atan;
}
Code:
int Degree_Buster_Buster(int targetx, int targety, int originx, int originy, int rad_angle){
int atan = ArcTan(targetx-originx,targety-originy);
if(Abs(rad_angle-atan)>PI){
if(atan>rad_angle)return (rad_angle-0.1745);
else return (rad_angle+0.1745);
}
else if(Abs(rad_angle-atan)>0.1745){
if(atan>rad_angle)return (rad_angle+0.1745);
else return (rad_angle-0.1745);
}
else return atan;
}
Re: Some scripts from Grikarugun.
So the second one is just the same, but in radians?
Re: Some scripts from Grikarugun.
Quote:
Originally Posted by
Joe123
So the second one is just the same, but in radians?
Yep. They do the same exact thing exept for the type of value you input and they return. ^_^
I realized after using the first one that I'd need the second to save on space for some other stuff, and for a boss. Betcha can't eat just one!
Re: Some scripts from Grikarugun.
GEEZ, you guys are hardcore! :odd: I know enough scripting to get by, but this stuff is overkill... I feel like I don't belong here at AGN... X_X
I wish I could tell you how great you are, Gleeok, but you lost me a few pages ago...