beefster09
01-20-2007, 07:06 PM
Instead of a stream of fireballs, it draws a line and a beam end. But I've run across a few problems. The beamos won't start his laser jet. Also note the commented Line function. I can't figure out how to get it through the compiler, so I commented it out.
Anyway:
//-----Scripts for Beamos-----
// When you are close enough, the beamos shoots
// a laser at you. It draws a line representing
// a laser shot from the beamos's eye. A damage
// combo represents the tip of the laser.
//----------------------------
import "std.zh"
//-----BeamosEye-----
// This half determines when the beam should be fired
//
// D0 = The radius of the beamos's sight
// D1 = The delay (in frames) waited before firing (I'd recommend 20)
//-------------------
ffc script BeamosEye{
void run(float radius, int maxdelay){
int currentdelay = 0; // delay waited
bool delaystart = false; // flag for start of delay
float xdist; // used to find how close Link is
float ydist; // same
float hdist; // distance between Link and Eye
Screen->D[0] = 0; // link's xy position
Screen->D[1] = 0; // tells whether link is close enough
Screen->D[2] = this->X + ((this->Y/100)/100) + 8.0008; // xy of eye
while(true){
xdist = this->X - Link->X;
ydist = this->Y - Link->Y;
hdist = Sqrt(Pow(xdist, 2) + Pow(ydist, 2));
// ^Distance formula^
if((hdist <= radius) && (!delaystart)){
Trace(9);
Screen->D[0] = Link->X + ((Link->Y/100)/100);
delaystart = true;
currentdelay = 0;
} //end if
if((hdist > radius) && (Screen->D[1] == 1) || (delaystart)){
Screen->D[1] = 0;
delaystart = false;
} //end if
if(delaystart){
currentdelay += 1;
} //end if
if(currentdelay == maxdelay){
Screen->D[1] = 1;
} //end if
Waitframe();
} //end while
} //end void
} //end ffc script
//--------Beam-------
// This half draws the beam and follows Link
//
// D0 = Speed of the travelling beam
// D1 = Color of the beam
// D2 = Combo to be changed to when active
//-------------------
ffc script Beam{
void run(float speed, float beamcolor, int activecombo){
int passivecombo = this->Data; // combo for inactive beam
bool active = false; // flag determining whether this is active
float xdist; // xdelta of target
float ydist; // ydelta of target
float xratio; // ratio between xdelta and ydelta
float yratio; // same
float hratio; // hypotenuse ratio
float tempxy; // xy of Beam
while(true){
// activation device
if((Screen->D[1] == 1) && (!active)){
this->X = Floor(Screen->D[0]);
this->X = Ceiling(Screen->D[0]) * 100 * 100;
active = true;
this->Data = activecombo;
} //end if
// moving device / line draw-er
if(active){
xratio = 1;
yratio = 1;
xdist = Link->X - this->X;
ydist = Link->Y - this->Y;
if(xdist > ydist){
xratio = xdist / ydist;
} // end if
if(xdist <= ydist){
yratio = ydist / xdist;
} // end if
hratio = Sqrt(Pow(xratio, 2) + Pow(yratio, 2));
xratio = xratio / hratio;
xratio = xratio * speed;
yratio = yratio / hratio;
yratio = yratio * speed;
this->Vx = xratio;
this->Vy = yratio;
tempxy = this->X + ((this->Y/100)/100) + 8.0008;
//Line(tempxy, beamcolor, Screen->D[2], 3, 1, false, 0, 0, 0);
} //end if
// deactivation device
if((Screen->D[1] == 0) && (active)){
this->Vx = 0;
this->Vy = 0;
this->X = 0;
this->Y = 0;
active = false;
this->Data = passivecombo;
} //end if
Waitframe();
} //end while
} //end void
} //end ffc script
What am I doing wrong?
Anyway:
//-----Scripts for Beamos-----
// When you are close enough, the beamos shoots
// a laser at you. It draws a line representing
// a laser shot from the beamos's eye. A damage
// combo represents the tip of the laser.
//----------------------------
import "std.zh"
//-----BeamosEye-----
// This half determines when the beam should be fired
//
// D0 = The radius of the beamos's sight
// D1 = The delay (in frames) waited before firing (I'd recommend 20)
//-------------------
ffc script BeamosEye{
void run(float radius, int maxdelay){
int currentdelay = 0; // delay waited
bool delaystart = false; // flag for start of delay
float xdist; // used to find how close Link is
float ydist; // same
float hdist; // distance between Link and Eye
Screen->D[0] = 0; // link's xy position
Screen->D[1] = 0; // tells whether link is close enough
Screen->D[2] = this->X + ((this->Y/100)/100) + 8.0008; // xy of eye
while(true){
xdist = this->X - Link->X;
ydist = this->Y - Link->Y;
hdist = Sqrt(Pow(xdist, 2) + Pow(ydist, 2));
// ^Distance formula^
if((hdist <= radius) && (!delaystart)){
Trace(9);
Screen->D[0] = Link->X + ((Link->Y/100)/100);
delaystart = true;
currentdelay = 0;
} //end if
if((hdist > radius) && (Screen->D[1] == 1) || (delaystart)){
Screen->D[1] = 0;
delaystart = false;
} //end if
if(delaystart){
currentdelay += 1;
} //end if
if(currentdelay == maxdelay){
Screen->D[1] = 1;
} //end if
Waitframe();
} //end while
} //end void
} //end ffc script
//--------Beam-------
// This half draws the beam and follows Link
//
// D0 = Speed of the travelling beam
// D1 = Color of the beam
// D2 = Combo to be changed to when active
//-------------------
ffc script Beam{
void run(float speed, float beamcolor, int activecombo){
int passivecombo = this->Data; // combo for inactive beam
bool active = false; // flag determining whether this is active
float xdist; // xdelta of target
float ydist; // ydelta of target
float xratio; // ratio between xdelta and ydelta
float yratio; // same
float hratio; // hypotenuse ratio
float tempxy; // xy of Beam
while(true){
// activation device
if((Screen->D[1] == 1) && (!active)){
this->X = Floor(Screen->D[0]);
this->X = Ceiling(Screen->D[0]) * 100 * 100;
active = true;
this->Data = activecombo;
} //end if
// moving device / line draw-er
if(active){
xratio = 1;
yratio = 1;
xdist = Link->X - this->X;
ydist = Link->Y - this->Y;
if(xdist > ydist){
xratio = xdist / ydist;
} // end if
if(xdist <= ydist){
yratio = ydist / xdist;
} // end if
hratio = Sqrt(Pow(xratio, 2) + Pow(yratio, 2));
xratio = xratio / hratio;
xratio = xratio * speed;
yratio = yratio / hratio;
yratio = yratio * speed;
this->Vx = xratio;
this->Vy = yratio;
tempxy = this->X + ((this->Y/100)/100) + 8.0008;
//Line(tempxy, beamcolor, Screen->D[2], 3, 1, false, 0, 0, 0);
} //end if
// deactivation device
if((Screen->D[1] == 0) && (active)){
this->Vx = 0;
this->Vy = 0;
this->X = 0;
this->Y = 0;
active = false;
this->Data = passivecombo;
} //end if
Waitframe();
} //end while
} //end void
} //end ffc script
What am I doing wrong?