func Initialize() { inherited(...); SetR(90); SetGraphics(nil, Javelin); PlayAnimation("Base", 5, Anim_Const(0), Anim_Const(1000)); AddEffect("HitCheck", this, 1,2, nil,nil); }
func Construction(object creator) { power_seconds = 0; lastcharge = 0; anim = PlayAnimation("Charge", 1, Anim_Const(GetAnimationLength("Charge")), Anim_Const(1000)); SetAction("Default"); return _inherited(creator, ...); }
public func Construction() { this.MeshTransformation = Trans_Rotate(Random(360), 0, 1, 0); var sibling = nil; for (var bone in ["bone1", "bone2", "bone3"]) { var transformation; var rand = Random(2); if (rand == 0) transformation = Trans_Rotate(RandomX(-20, 20), 1, 0, 0); else if(rand == 1) transformation = Trans_Rotate(RandomX(-20, 20), 0, 0, 1); sibling = TransformBone(bone, transformation, 1, Anim_Const(1000), sibling); } }
func Construction() { // general stuff StartGrowth(15); current_angle = Random(360); current_speed = RandomX(SwimMaxSpeed/5, SwimMaxSpeed); var len = GetAnimationLength("Swim"); swim_animation = PlayAnimation("Swim", 5, Anim_Linear(0, 0, len, 100, ANIM_Loop), Anim_Const(500)); UpdateSwim(); SetAction("Swim"); SetComDir(COMD_None); ScheduleCall(this, this.InitActivity, 1 + Random(10), 0); AddTimer(this.UpdateSwim, 2); InitFuzzyRules(); return _inherited(...); }
global func DoFireBreath(proplist fx, int x, int y, int tx, int ty, int timer) { var anim_length = 12; var sx = x - 3 + 6 * fx.cyclops->GetDir(); var sy = y - 15; // effects if (fx.spraying_charge <= 0) { if (ObjectDistance(fx.cyclops, fx.target) < CYCLOPS_FireBreath_Reach && fx.spraying < CYCLOPS_FireBreath_Duration) { var action = "IdleLookAround"; fx.cyclops->PlayAnimation(action, CLONK_ANIM_SLOT_Arms, Anim_Linear(0, 0, fx.cyclops->GetAnimationLength(action), anim_length, ANIM_Remove), Anim_Linear(0, 0, 1000, 5, ANIM_Remove)); fx.spraying_charge = 1; } } else if (fx.spraying_charge < anim_length) { fx.spraying_charge++; if (fx.spraying_charge >= anim_length) { fx.cyclops->Sound("BalloonInflate"); } } else if (fx.spraying < CYCLOPS_FireBreath_Duration) { var target_angle = Normalize(Angle(sx, sy, tx, ty), -180); var source_angle = -90 + fx.cyclops->GetDir() * 180; var a = Min(CYCLOPS_FireBreath_Duration, fx.spraying * 2); var b = CYCLOPS_FireBreath_Duration - a; var angle = (b * source_angle + a * target_angle) / CYCLOPS_FireBreath_Duration; angle = Normalize(angle, -180); var head_angle = Normalize(angle - source_angle, -180); // turn his head towards the clonk // somehow the turning head makes the cyclops invisible, though var transform = Trans_Rotate(10, 0, 0, 1); //var transform = Trans_Rotate(head_angle, 0, 0, 1); if (!fx.anim_nr) { fx.anim_nr = fx.cyclops->TransformBone("skeleton_head", transform, 5, Anim_Const(1000)); } else { fx.cyclops->SetAnimationBoneTransform(fx.anim_nr, transform); } fx.spraying = Min(CYCLOPS_FireBreath_Duration, fx.spraying + 1); var distance = Min(CYCLOPS_FireBreath_Reach, ObjectDistance(fx.cyclops, fx.target)); FireBreathEffect(fx, angle, distance, sx, sy, timer); FireBreathDamage(fx, angle, distance, sx, sy); } else { // cooldown and reset fx.spraying = Min(2 * CYCLOPS_FireBreath_Duration, Max(CYCLOPS_FireBreath_Duration + 1, fx.spraying + 1)); if (fx.spraying == 2 * CYCLOPS_FireBreath_Duration) { fx.spraying = 0; fx.spraying_charge = 0; fx.spray_old = {time = 0, v0 = 0, v1 = 0, reach = 0}; fx.spray_cur = {time = 0, v0 = 0, v1 = 0, reach = 0}; } } }