forked from Mirrors/openclonk
adapted MuzzleFlash particle and usages to new particle system
parent
875823644d
commit
0aeb38f137
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -0,0 +1,3 @@
|
|||
[Particle]
|
||||
Name=MuzzleFlash
|
||||
Face=0,0,64,64,-32,-32
|
|
@ -174,8 +174,7 @@ private func FireWeapon(object clonk, int angle)
|
|||
var y = -Cos(angle, 20);
|
||||
CreateParticleEx("Smoke", IX, IY, PV_Random(x - 20, x + 20), PV_Random(y - 20, y + 20), PV_Random(40, 60), Particles_Smoke(), 20);
|
||||
|
||||
CreateParticle("MuzzleFlash",IX,IY,+Sin(angle,500),-Cos(angle,500),450,RGB(255,255,255),clonk);
|
||||
|
||||
clonk->CreateMuzzleFlash(IX, IY, angle, 40);
|
||||
CreateParticleEx("Flash", 0, 0, 0, 0, 8, Particles_Flash());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
[Particle]
|
||||
Name=MuzzleFlash
|
||||
MaxCount=130
|
||||
InitFn=StdInit
|
||||
ExecFn=StdExec
|
||||
DrawFn=Std
|
||||
Face=0,0,64,64,-32,-32
|
||||
Delay=1
|
||||
Repeats=1
|
||||
GravityAcc=0
|
||||
Additive=1
|
||||
RByV=2
|
||||
Attach=1
|
|
@ -171,8 +171,8 @@ private func FireWeapon(object clonk, int angle)
|
|||
var x = Sin(angle, 20);
|
||||
var y = -Cos(angle, 20);
|
||||
CreateParticleEx("Smoke", IX, IY, PV_Random(x - 20, x + 20), PV_Random(y - 20, y + 20), PV_Random(40, 60), Particles_Smoke(), 20);
|
||||
|
||||
CreateParticle("MuzzleFlash",IX,IY,+Sin(angle,500),-Cos(angle,500),450,RGB(255,255,255),clonk);
|
||||
clonk->CreateMuzzleFlash(IX, IY, angle, 20);
|
||||
|
||||
CreateParticleEx("Flash", 0, 0, 0, 0, 8, Particles_Flash());
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public func ContainedUseStop(object clonk, int ix, int iy)
|
|||
var y = -Cos(angle, 20);
|
||||
CreateParticleEx("Smoke", IX, IY, PV_Random(x - 20, x + 20), PV_Random(y - 20, y + 20), PV_Random(40, 60), Particles_Smoke(), 20);
|
||||
|
||||
CreateParticle("MuzzleFlash",IX,IY,+Sin(angle,500),-Cos(angle,500),600,RGB(255,255,255),this);
|
||||
CreateMuzzleFlash(IX, IY, angle, 20);
|
||||
CreateParticleEx("Flash", 0, 0, GetXDir(), GetYDir(), 8, Particles_Flash());
|
||||
|
||||
AddEffect("IntCooldown", this,1,1,this);
|
||||
|
|
|
@ -280,9 +280,7 @@ protected func DoFire(object iammo, object clonk, int angle)
|
|||
var x = Sin(r/angPrec, 20);
|
||||
var y = -Cos(r/angPrec, 20);
|
||||
CreateParticleEx("Smoke", px, py, PV_Random(x - 20, x + 20), PV_Random(y - 20, y + 20), PV_Random(40, 60), Particles_Smoke(), 20);
|
||||
|
||||
CreateParticle("MuzzleFlash",px,py,px,py+4,700,RGB(255,255,255)); //muzzle flash uses speed as Rotation... so I negate the -4
|
||||
|
||||
CreateMuzzleFlash(px, py, r / angPrec, 60);
|
||||
//sound
|
||||
Sound("Blast3");
|
||||
}
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
/**
|
||||
This file contains some default particle behavior definitions.
|
||||
This file contains some default particle behavior definitions as well as helper functions.
|
||||
*/
|
||||
|
||||
/* particle helper/effect functions */
|
||||
|
||||
global func CreateMuzzleFlash(int x, int y, int angle, int size)
|
||||
{
|
||||
// main muzzle flash
|
||||
CreateParticleEx("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);
|
||||
CreateParticleEx("StarFlash", x, y, PV_Random(xdir - size, xdir + size), PV_Random(ydir - size, ydir + size), PV_Random(20, 60), Particles_Glimmer(), size);
|
||||
}
|
||||
|
||||
/* particle definitions */
|
||||
global func Particles_Dust()
|
||||
{
|
||||
return
|
||||
|
@ -218,4 +231,35 @@ global func Particles_Thrust(int size)
|
|||
ForceX = PV_KeyFrames(0, 0, 0, 500, 0, 1000, PV_Wind(50)),
|
||||
CollisionVertex = 750
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_MuzzleFlash()
|
||||
{
|
||||
return
|
||||
{
|
||||
Attach = ATTACH_Front | ATTACH_MoveRelative,
|
||||
Size = 20,
|
||||
Phase = PV_Linear(0, 5),
|
||||
BlitMode = GFX_BLIT_Additive
|
||||
};
|
||||
}
|
||||
|
||||
global func Particles_Glimmer()
|
||||
{
|
||||
return
|
||||
{
|
||||
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,
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue