PDA

View Full Version : Ball and Chain Trooper (Mk. I)



_L_
11-10-2007, 03:49 AM
//
// "Ball and Chain Trooper"
// Attach this to the Ball FFC.
// Flags:
// * Changer (so that it is invisible when the screen scrolls in).
//
// d0: ID of the enemy to create.
// d1: speed of rotation.
// d2: x radius of ellipse.
// d3: y radius of ellipse.
//
ffc script BallChainTrooper1
{
void run(int enemynum, int speed, int xradius, int yradius) {
this->Flags[FFCF_CHANGER] = false; // Make visible
int clk = 0;
npc trooper = Screen->CreateNPC(enemynum);
trooper->X = this->X;
trooper->Y = this->Y;
while(trooper->isValid()) {
clk++;
//
this->X = trooper->X + Cos(clk*speed) * xradius;
this->Y = trooper->Y - Sin(clk*speed) * yradius;
// Replace the 17 in the next line with the desired colour number for your quest.
Screen->Line(3, this->X+8, this->Y+8, trooper->X+8,trooper->Y+8,17,1,0,0,0,128);
Waitframe();
}
this->Data = 0;
}
}

This is probably the most basic ball and chain script imaginable. The enemy just keeps spinning it round and round, forever. No speeding up or spreading out the ball, and no lugging it at Link when he gets near. And the 'chain' is just a one-pixel-thick line. So it's more like a ball and rope. Whoever heard of a ball and rope? That'd be, like, a shot put or something.