Example #1
0
func CheckForEnemies(Size)
{
	for(var o in FindObjects(Find_Distance(Size), Find_Func("CanBeHit", this)))
	{
		if(o->GetOwner() == GetOwner() || GetEffect("BallHitCD", o))
			continue;
		
		o->AddBallHitEffect();
		o->Fling(0, -2);
		AddEffect("BallHitCD", o, 1, 15);
		
		var trailparticles =
		{
			Prototype = Particles_ElectroSpark2(),
			Size = PV_Linear(PV_Random(5,15),0),
			BlitMode = GFX_BLIT_Additive,
			Rotation = PV_Random(0,360),
			R = pR,
			G = pG,
			B = pB,
		};
		
		CreateParticle("Lightning", o->GetX() - GetX(), o->GetY() - GetY(), 0, 0, 10, trailparticles, 5);
		
		WeaponDamage(o, SpellDamage);
		Sound("Ball::ball_hit", false, 50);
	}
}
Example #2
0
func ChargeEffect(proplist params)
{
	var a = params.new_angle;
	var x = Sin(a, 10, 10);
	var y = -Cos(a, 10, 10);

	CreateParticle("Shockwave2", x, y, PV_Random(-10,10), PV_Random(-15, 5), 20, chargeprt, 1);
}
Example #3
0
global func FxFireScorchingTimer(object target, proplist effect, int time)
{
	if (time >= effect.duration) { RemoveObject(); return FX_Execute_Kill; }
	// particles
	var wind = BoundBy(GetWind(), -5, 5);
	CreateParticle("SmokeDirty", PV_Random(-5, 5), PV_Random(-5, 5), wind, -effect.strength/8, PV_Random(20, 40), Particles_SmokeTrail(), 2);
	return FX_OK;
}
Example #4
0
	Timer = func(int time)
	{
		var r = time / 3;
		this.Target->CreateParticle("StarSpark", PV_Random(-r, r), PV_Random(-r, r), 0, 0, PV_Random(60, 300), this.particles, 3);
		if (time > this.ChargeDuration)
			return FX_Execute_Kill;
		return FX_OK;
	}
Example #5
0
func CreateMuzzleFlash(int x, int y, int angle, int size)
{
	// main muzzle flash
	CreateParticle("MuzzleFlash", x, y, 0, 0, 10, {Prototype = Particles_MuzzleFlash(), Size = size, Rotation = angle});
	// and some additional little sparks
	var xdir = Sin(angle, size * 2);
	var ydir = -Cos(angle, size * 2);
	CreateParticle("StarFlash", x, y, PV_Random(xdir - size, xdir + size), PV_Random(ydir - size, ydir + size), PV_Random(5, 15), Particles_Glimmer(), size);
}
Example #6
0
func BloodSplatter(level)
{
	var particles = 
	{
		Size = PV_Random(1, 2),
		R = 255, G = 1, B = 1,
		Attach = ATTACH_Front
	};
	FindObject(Find_ID(CallbackRule))->CreateParticle("SmokeDirty", PV_Random(-7, 7), PV_Random(-7, 7), 0, 0, 0, particles, level);
}
Example #7
0
func ContactBottom()
{
	inherited(...);
	var particle = Particles_Spark();
	particle.R = 0xff;
	particle.G = 0xff;
	particle.B = PV_Random(150,200);
	CreateParticle("MagicSpark", 0,ReturnHeight()/2-1, PV_Random(-10,10), PV_Random(-10,10), PV_Random(10,50), particle, 15);
  Sound("Hits::LightMetalHit?", false, 20);
}
Example #8
0
func FxParticlesStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;

	SetSolidMask();
	
	var props = 
	{
		Size = PV_Linear(4, 0),
	    ForceY = GetGravity(),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
		OnCollision = PC_Die(),
		CollisionVertex = 0,
	    R = 100,
	    G = 100,
	    B = 100,
		BlitMode = GFX_BLIT_Additive,
	};
	CreateParticle("Smoke", 0, 0, PV_Random(-10 , 10), PV_Random(-10, 20), 50, props, 10);
	
	var smoke = 
	{
		ForceX = PV_Wind(200 - 180),
		DampingX = 900, DampingY = 900,
		Alpha = PV_Linear(255, 0),
		R = 100, G = 100, B = 100,
		Size = PV_Linear(PV_Random(4, 10), PV_Random(20, 30)),
		Phase = PV_Random(0, 15)
	};
	CreateParticle("Smoke", PV_Random(-5,5), PV_Random(-5,5), PV_Random(-15, 15), PV_Random(-15, 15), 30, smoke, 15);
}
Example #9
0
func Launch(object clonk, int x, int y)
{
	CreateParticle("Smoke", PV_Random(-5,5), PV_Random(-10,10), PV_Random(-5,5), 0, 30, Particles_Smoke(), 20);
	clonk.Visibility = VIS_Owner;
	clonk->SetClrModulation(RGBa(255,255,255,50));
	clonk->Sound("vanish", false, 50);
	
	var fx = AddEffect("ShadowWalk", clonk, 20, 1, nil, GetID());
	fx.dur = Dur;
	RemoveObject();
}
Example #10
0
func ContactBottom()
{
	inherited(...);
	var particle = Particles_Spark();
	particle.R = 0xff;
	particle.G = 0xff;
	particle.B = PV_Random(150,200);
	CreateParticle("Dust", 0,10, PV_Random(-3,3), PV_Random(-3,3), PV_Random(5,8), particle, 15);
	
//	CreateParticle(,0, 10, RandomX(-3,3),RandomX(-3,3),RandomX(50,75),DoRGBaValue(-7183302,128,0));
	Sound("Clonk::Action::Dig::Dig?");
}
Example #11
0
// Timer during movement: Draw tail
func Drawing()
{
	var x=GetX(), y=GetY();
	var vx=x-last_x, vy=y-last_y;
	last_x = x; last_y = y;
	var v=Distance(vx,vy);
	if (!v) return;
	var s1=v;
	var s2=4;
	var dx1=vx*s1/v, dy1=vy*s1/v, dx2=vy*s2/v, dy2=-vx*s2/v;
	x -= dx1; y -= dy1;
	DrawMaterialQuad("Gold-gold", x+dx1+dx2,y+dy1+dy2, x+dx1-dx2,y+dy1-dy2, x-dx1-dx2,y-dy1-dy2, x-dx1+dx2,y-dy1+dy2, true);
	CreateParticle("MagicSpark", 0,0, PV_Random(-vx*2-15,-vx*2+15), PV_Random(-vy*2-15,-vy*2+15), PV_Random(30,80), Particles_Colored(Particles_Spark(),GetPlayerColor(GetOwner())), 3);
	return true;
}
Example #12
0
func FxBloodTimer(target, effect, time)
{
	if (time > 80) return -1;
	var size = (90 - time) / 5;
	effect.particles.Size = PV_KeyFrames(0, 0, 0, 100, size, 900, size, 1000, 0);
	effect.particle_target->CreateParticle("Blood", GetX(), GetY(), 0, 0, PV_Random(60, 90), effect.particles);
}
Example #13
0
global func Particles_Leaves()
{
	return
	{
		Size = PV_Random(3, 6),
	    Phase = PV_Linear(0, 7*5),
		Alpha = PV_KeyFrames(0, 0, 255, 900, 255, 1000, 0),
		CollisionVertex = 500,
		OnCollision = PC_Stop(),
		ForceX = PV_Wind(100),
		ForceY = PV_Gravity(40),
		DampingX = 975, DampingY = 975,
		Rotation = PV_Direction(PV_Random(750, 1250)),
		Attach = nil
	};
}
Example #14
0
func FxLifeStop(object target, proplist effect, int reason, bool temporary)
{
	if(temporary)
		return;
	
	var prt = {
		Size = 15,
		Alpha = PV_Linear(255, 0),
		Rotation = PV_Step(15, PV_Random(0, 360)),
		ForceY = GetGravity()
	};
	CreateParticle("SawbladePrt", 0, 0, PV_Random(-35, 35), PV_Random(-35, 5), 40, prt, 6);
	
	var prt2 =	{
		Size = PV_Linear(2, 0),
	    ForceY = GetGravity(),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
	    R = 255,
	    G = PV_Linear(128,32),
	    B = PV_Random(0, 128, 2),
	    Alpha = PV_Random(255,0,3),
		BlitMode = GFX_BLIT_Additive,
	};
	
	CreateParticle("Flash", 0, 0, PV_Random(-35, 35), PV_Random(-35, 5), 70, prt2, 20);
	
	Sound("sawblade_destroyed", false, 50);
	RemoveObject();
}
Example #15
0
func InitEffect()
{
    Sound("Fire::Fireball", false, 100, nil, nil, nil, 200);
    Sound("Fire::FuseLoop", false, 20, nil, 1, nil, 200);
    SetLightRange(30, 70);
    SetLightColor(RGB(100, 100, 255));

    var snow =
    {
        R = 200,
        G = 200,
        B = 255,
        Alpha = PV_Linear(255, 0),
        Size = PV_Random(0, 2),
        CollisionVertex = 0,
        OnCollision = PC_Stop(),
        ForceX = PV_Random(-5, 5, 10),
        ForceY = PV_Gravity(100),
        DampingX = 900, DampingY = 900
    };

    trail_particles =
    {
        R = PV_Random(200, 255), G = PV_Random(200, 255), B = 255,
        Prototype = Particles_FireTrail(),
        Size = PV_Linear(10, 0),
        BlitMode = nil,
        Rotation = PV_Random(0, 360),
        BlitMode = GFX_BLIT_Additive
    };

    CreateParticle("StarFlash", 0, 0, PV_Random(-30, 30), PV_Random(-30, 30), 100, snow, 100);
}
Example #16
0
func FxBlockedTimer(object target, proplist fx, int time)
{
	if(time >= BlockDur)
		return -1;
	
	var lightning =
	{
		Prototype = Particles_ElectroSpark2(),
		Size = PV_Linear(PV_Random(3,6),0),
		BlitMode = GFX_BLIT_Additive,
		Rotation = PV_Random(0,360),
		R = 100,
		G = 100,
		B = pB,
		Attach = ATTACH_Front,
	};
	
	target->CreateParticle("Lightning", RandomX(-6, 6), RandomX(-6, 6), 0, 0, 20, lightning, 3);
}
Example #17
0
func FxTimeHitTimer(object target, proplist effect, int time)
{
	var lightning =
	{
		Prototype = Particles_ElectroSpark2(),
		Size = PV_Linear(PV_Random(2,5),0),
		BlitMode = GFX_BLIT_Additive,
		Rotation = PV_Random(0,360),
		R = 255,
		G = 150,
		B = 50,
		Attach = ATTACH_Front | ATTACH_MoveRelative,
	};
	
	target->CreateParticle("Lightning", RandomX(-5, 5), RandomX(-10, 10), 0, 0, 10, lightning, 2);
	
	if(time > 40)
		return -1;
}
Example #18
0
func Initialize()
{
	SetCategory(0);
	
	AddTimer("SwimAround", 15);
	SetAction("Swim");
	SetComDir(COMD_None);
	
	var particles = 
	{
		Size = PV_Sin(PV_Step(PV_Random(1, 2)), PV_Random(0, 1), PV_Random(1,2)),
		Attach = ATTACH_MoveRelative,
		Alpha = 100
	};
	particles = Particles_Colored(particles, HSL(Random(255), 100, 75));
	
	var amount = RandomX(5, 10);
	CreateParticle("SphereSpark", PV_Random(-3, 3), PV_Random(-3, 3), 0, 0, 0, particles, amount);
}
Example #19
0
func BlockEffect(object clonk, int radius)
{
	var trailparticles =
	{
		Size = PV_KeyFrames(0, 0, 0, 200, PV_Random(10, 25), 1000, 0),
		Alpha = PV_Linear(255, 0),
		OnCollision = PC_Die(),
		CollisionVertex = 0,
		DampingX = 900, DampingY = 900,
		BlitMode = GFX_BLIT_Additive
	};
	trailparticles = Particles_Colored(trailparticles, GetPlayerColor(clonk->GetOwner()));
	
	clonk->CreateParticle("Shockwave",
		PV_Sin(PV_Random(0, 360, 0, 1), PV_Random(radius - 1, radius + 1, 0, 2)),
		PV_Cos(PV_Random(0, 360, 0, 1), PV_Random(radius - 1, radius + 1, 0, 2)),
		PV_Random(-5, 5), PV_Random(-5, 5), PV_Random(20, 30), trailparticles, 100);
}
Example #20
0
func Initialize()
{
	chargeprt =
	{
		Size = 5,
		Alpha = PV_Linear(255, 0),
		R = 150,
		G = 150,
		B = 150,
		ForceY = GetGravity(),
		Stretch = PV_Linear(1500, 1500),
		Rotation = PV_Step(10, PV_Random(0, 360), 1),
		OnCollision = PC_Bounce(),
	};
	snapped = false;
	
	
}
Example #21
0
func RiftSparks(int radius)
{
	var flash_particles =
	{ 
		Prototype = Particles_Flash(),
		Size = radius,
	};
	
	var alpha = 120;
	
	
	var cSmokeR = PV_KeyFrames(0, 0, 227, 500, 191, 1000, 50);
	var cSmokeG = PV_KeyFrames(0, 0, 170, 500, 200, 1000, 50);
	var cSmokeB = PV_KeyFrames(0, 0, 255, 500, 255, 1000, 50);
	
	if (!Random(2)) // invert order of colors
	{
		cSmokeR = PV_KeyFrames(0, 0, 191, 500, 227, 1000, 50);
		cSmokeG = PV_KeyFrames(0, 0, 200, 500, 170, 1000, 50);
		cSmokeB = PV_KeyFrames(0, 0, 255, 500, 255, 1000, 50);
	}

	var dust_particles =
	{
		Prototype = Particles_Dust(),
		Size = PV_KeyFrames(0, 0, 0, 100, radius, 1000, 0),
		Alpha = PV_KeyFrames(0, 0, alpha, 750, alpha, 1000, 0),
		R = cSmokeR,
		G = cSmokeG,
		B = cSmokeB,
	};

	// Create some particles
	CreateParticle("Dust",  g_DimensionRift_X, g_DimensionRift_Y, PV_Random(-radius / 2, radius / 2), PV_Random(-radius / 2, radius / 2), PV_Random(18, 36), dust_particles, radius);
	CreateParticle("Flash", g_DimensionRift_X, g_DimensionRift_Y, 0, 0, 30, flash_particles);
}
Example #22
0
func TravelEffect(int time)
{
    CreateParticle("StarFlash", 0, 0, PV_Random(-7,7), PV_Random(-7,7), 10, trail_particles, 3);
    if (time > MaxTime)
        Hit();
}
Example #23
0
global func ExplosionParticles_Init()
{
	ExplosionParticles_Smoke =
	{	    
		Size = PV_KeyFrames(0, 180, 25, 1000, 50),
	    DampingY = PV_Random(890, 920, 5),
		DampingX = PV_Random(900, 930, 5),
		ForceY=-1,
		ForceX = PV_Wind(20, PV_Random(-2, 2)),
		Rotation=PV_Random(0,360,0),
		R=PV_KeyFrames(0, 0, 255, 260, 64, 1000, 64),
		G=PV_KeyFrames(0, 0, 128,  260, 64, 1000, 64),
		B=PV_KeyFrames(0, 0, 0, 260, 108, 1000, 108),
	    Alpha = PV_KeyFrames(0, 0, 0, 100, 20, 500, 20, 1000, 0)
	};
	
	ExplosionParticles_Blast =
	{
		Size = PV_KeyFrames(0, 0, 0, 260, 25, 1000, 40),
		DampingY = PV_Random(890, 920, 0),
		DampingX = PV_Random(900, 930, 0),
		ForceY = PV_Random(-8,-2,0),
		ForceX = PV_Random(-5,5,0),
		R = 255,
		G = PV_Random(64, 120, 0),
		Rotation = PV_Random(0, 360, 0),
		B = 0,
		Alpha = PV_KeyFrames(0, 260, 100, 1000, 0),
		BlitMode = GFX_BLIT_Additive,
		Phase = PV_Random(0, 1)
	};
	
	ExplosionParticles_BlastSmooth =
	{
		Size = PV_KeyFrames(0, 0, 0, 250, PV_Random(30, 50), 1000, 80),
		R = PV_KeyFrames(0, 0, 255, 250, 128, 1000, 0),
		G = PV_KeyFrames(0, 0, 255, 125, 64, 1000, 0),
		Rotation = PV_Random(0, 360, 0),
		B = PV_KeyFrames(0, 0, 100, 250, 64, 100, 0),
		Alpha = PV_KeyFrames(0, 0, 255, 750, 250, 1000, 0),
		BlitMode = GFX_BLIT_Additive
	};
	
	ExplosionParticles_BlastSmoothBackground =
	{
		Prototype = ExplosionParticles_BlastSmooth,
		BlitMode = nil,
		R = PV_Linear(50, 0),
		G = PV_Linear(50, 0),
		B = PV_Linear(50, 0),
		Alpha = PV_Linear(128, 0)
	};
	
	ExplosionParticles_Star =
    {
        Size = PV_KeyFrames(0, 0, 0, 500, 60, 1000, 0),
        R = PV_KeyFrames(0, 750, 255, 1000, 0),
        G = PV_KeyFrames(0, 300, 255, 1000, 0),
        B = PV_KeyFrames(0, 300, 255, 500, 0),
		Rotation = PV_Random(0, 360, 4),
        Alpha = PV_KeyFrames(0, 750, 255, 1000, 0),
		BlitMode = GFX_BLIT_Additive,
		Stretch = PV_Speed(1000, 1000)
    };
    
	ExplosionParticles_Shockwave =
    {
        Size = PV_Linear(0, 120),
        R = 255,
        G = 128,
        B = PV_KeyFrames(0, 0, 128, 200, 0),
		Rotation = PV_Step(20),
		BlitMode = GFX_BLIT_Additive,
        Alpha = PV_Linear(255, 0)
    };
    
    ExplosionParticles_Glimmer=
	{
		Size = PV_Linear(2, 0),
	    ForceY = GetGravity(),
		DampingY = PV_Linear(1000,700),
		DampingX = PV_Linear(1000,700),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
		OnCollision = PC_Die(),
		CollisionVertex = 500,
	    R = 255,
	    G = PV_Linear(128,32),
	    B = PV_Random(0, 128, 2),
	    Alpha = PV_Random(255,0,3),
		BlitMode = GFX_BLIT_Additive,
	};
}
Example #24
0
func Intro_PlaneHit()
{
	// Plane hit ground! Continue sequence.
	Sound("Objects::Plane::PlaneCrash", true);
	SetR(-90);
	var particles = Particles_Smoke(true);
	particles.Size = PV_Linear(PV_Random(20, 60), PV_Random(50, 100));
	CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-60, 60), PV_Random(-20,0), PV_Random(200, 500), particles, 20);
	particles.Size = PV_Linear(PV_Random(50, 80), PV_Random(100, 200));
	CreateParticle("Smoke", PV_Random(-30,30), PV_Random(-30,30), PV_Random(-20, 20), PV_Random(-20,0), PV_Random(100, 200), particles, 20);
	for (var iplr=0,plr; iplr<GetPlayerCount(C4PT_User); ++iplr)
	{
		plr = GetPlayerByIndex(iplr, C4PT_User);
		var icrew=0,crew;
		while (crew=GetCrew(plr, icrew++))
		{
			crew->Exit(0,-5, 0, Random(1)+1, Random(5)-6);
			crew->SetAction("Tumble");
		}
	}
	SetMeshMaterial("CrashedAirplane");
	this.MeshTransformation=Trans_Mul(Trans_Rotate(10,0,2,1), Airplane.MeshTransformation);
	this.Hit = this.intro_seq.plane_Hit;
	this.intro_seq.plane_crashed = true;
	this.intro_seq->ScheduleNext(50);
	return true;
}
Example #25
0
func TravelEffect(int time)
{
	CreateParticle("Fire", 0, 0, PV_Random(-7,7), PV_Random(-7,7), 10, firetrailparticles, 3);
}
Example #26
0
func Fuse()
{
	Sound("Fire::Spark*");
	CreateParticle("Fire", 0, 0, PV_Random(-5, 5), PV_Random(-15, 5), PV_Random(10, 40), Particles_Glimmer(), 5);
	return true;
}
Example #27
0
func FxSparkleTimer(target, effect, time)
{
	effect.Interval *= 2;
	if(effect.Interval > 35*3) return -1;
	CreateParticle("StarSpark", PV_Random(-3, 3), PV_Random(-14, -10), PV_Random(-5, 5), PV_Random(-8, 0), 10, Particles_Magic(), 4);
}
Example #28
0
func Hit() {
  Sound("FleshHit*");
  CreateParticle("SmokeDirty", 0, 0, PV_Random(-30, 30), PV_Random(-30, 30), PV_Random(40, 90), Particles_Material(RGB(200, 1, 1)), 40);  
  RemoveObject();
  return(1);
}
Example #29
0
func ChargeEffect(proplist params)
{
	var clonk = params.clonk;

	for(var i = 0; i < 360; i+= RandomX(3,15))
	{
		if(!Random(10))
		{
			var props =
			{
				Prototype = Particles_FireTrail(),
				Size = PV_Linear(10,0),
				BlitMode = GFX_BLIT_Additive,
				OnCollision=nil,
				CollisionVertex=nil
			};
			
			var xdir = Sin(i + 180, RandomX(15, 30));
			var ydir = -Cos(i + 180, RandomX(15, 30));
			
			CreateParticle("Fire", clonk->GetX() - GetX() + Sin(i, 30), clonk->GetY() - GetY() - Cos(i, 30), PV_Random(xdir -2, xdir + 2), PV_Random(ydir - 2 , ydir + 2), 20, props, 2);
		}
	}
}
Example #30
0
func FxFireDashTimer(object target, proplist effect, int time)
{
	var a = effect.angle;
		
	var x = target->GetX();
	var y = target->GetY();
	
	target->SetPosition(target->GetX() + Sin(a, 6, effect.angle_prec), target->GetY() + -Cos(a, 6, effect.angle_prec));

	for(var o in FindObjects(Find_Distance(effect.Size1, x, y), Find_Func("CanBeHit", target)))
	{
		if(o->GetOwner() == target->GetOwner())
			continue;
		if(!GetEffect("DashCD", o))
		{
			o->Fling(0, -5);
			AddEffect("DashCD", o, 20, 10);
			o->AddFireHitEffect();
			target->WeaponDamage(o, effect.SpellDamage1);
		}
		
	}
	
	var chaoticspark =
	{
		Size = PV_Linear(1, 0),
		ForceX = PV_KeyFrames(10, 0, PV_Random(-6, 6), 333, PV_Random(-6, -6), 666, PV_Random(6, 6), 1000, PV_Random(-6, 6)),
		ForceY = PV_KeyFrames(10, 0, PV_Random(-8, 5), 333, PV_Random(-8, 5), 666, PV_Random(-10, 10), 1000, PV_Random(-10, 15)),
		Stretch = PV_Speed(1000, 500),
		Rotation = PV_Direction(),
		CollisionVertex = 0,
		OnCollision = PC_Die(),
		R = 255,
		G = PV_Linear(255,100),
		B = PV_Random(0, 100),
		DampingX=950,
		DampingY=950,
		Alpha = PV_Random(100,180),
		BlitMode = GFX_BLIT_Additive
	};
	CreateParticle("Magic", x + RandomX(-5, 5), y + RandomX(-10, 10), RandomX(25, -25) + target->GetXDir(), RandomX(-25, 12) + target->GetYDir(), 50, chaoticspark, 4);


	var firetrailparticles =
	{
		Prototype = Particles_FireTrail(),
		Size = PV_Linear(effect.Size1,0),
		BlitMode = GFX_BLIT_Additive,
		OnCollision=nil,
	};
	CreateParticle("Fire", x, y, PV_Random(-7,7), PV_Random(-7,7), 20, firetrailparticles, 3);
	
	var dist = Distance(x, y, effect.startx + effect.tx, effect.starty + effect.ty);
	if(dist < 10 || (dist > effect.dist + 1 && time > 10))
	{
		effect.clonk->SetObjectLayer(nil);
		return -1;
	}
	else
	{
		//Log("%d %d", dist, effect.dist);
		effect.dist = dist;
	}
	
}