Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace std
- {
- namespace weapons
- {
- namespace laser
- {
- // Set the weapon's direction based on its angle;
- // Can also makes weapons unblockable
- void Aim(eweapon wpn)
- {
- float angle=wpn->Angle%6.2832;
- int dir;
- if(angle<0)
- angle+=6.2832;
- if(angle<0.3927 || angle>5.8905)
- dir=DIR_RIGHT;
- else if(angle<1.1781)
- dir=DIR_RIGHTDOWN;
- else if(angle<1.9635)
- dir=DIR_DOWN;
- else if(angle<2.7489)
- dir=DIR_LEFTDOWN;
- else if(angle<3.5343)
- dir=DIR_LEFT;
- else if(angle<4.3197)
- dir=DIR_LEFTUP;
- else if(angle<5.1051)
- dir=DIR_UP;
- else
- dir=DIR_RIGHTUP;
- wpn->Dir=dir;
- }
- eweapon Fire(int weaponID, int x, int y, float angle, int step, int damage)
- {
- eweapon wpn=Screen->CreateEWeapon(weaponID);
- wpn->X=x;
- wpn->Y=y;
- wpn->Step=step;
- wpn->Damage=damage;
- wpn->Angular=true;
- wpn->Angle=ArcTan(Link->X-x, Link->Y-y)+angle;
- Aim(wpn);
- return wpn;
- }
- //DEFAULT VALUES
- const int LAYER = 3;
- const int COLOUR = 0x04;
- const int OPACITY = 128;
- const int ANGLE_VISION = 60;
- const int SPEED = 120;
- const int COOLDOWN = 150;
- const int WEAPONID = EW_SCRIPT1;
- const int SOUND = 70;
- }
- }
- }
- eweapon script laz
- {
- void run(int speed, int colour, int layer, int fizzlesfx, int fizzlesprite)
- {
- int startX = this->X; //light bending if Parent->X
- Audio->PlaySound(shotsfx); //because enemy editor shot sound isn't variable yet
- this->Angular = true;
- this->Angle = ArcTan(Link->X-this->X, Link->Y-this->Y);
- this->Step = speed;
- //this->Damage = Game->LoadNPCData(this->Parent)->WeaponDamage; //should get bthis from the enemy editor
- this->DrawYOffset = -32768; //make wpn sprite invisible
- while(1)
- {
- if (Screen->isSolid(CenterX(this), CenterY(this))
- {
- this->DeadState = WDS_DEAD;
- Audio->PlaySound(fizzlesfx);
- if(fizzlesprite)
- {
- lweapon fiz = Screen->CreateLWeapon(LW_SPARKLE);
- fiz->UseSprite(fizzlesprite);
- fiz->CollDetection = false;
- fiz->X = this->X;
- fiz->Y = this->Y;
- }
- }
- else
- {
- Screen->Line(layer, startX, this->Y, CenterX(this), CenterY(this), colour, 1, 0, 0, 0, 128);
- }
- Waitframe();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement