Particles using display coordinates, particle growtime, character death&stun animations

This commit is contained in:
Regalis
2015-09-05 12:13:44 +03:00
parent 0cbcdd0b03
commit 04d55891f0
22 changed files with 346 additions and 206 deletions
+7 -6
View File
@@ -51,21 +51,22 @@ namespace Subsurface
public void Explode(Vector2 simPosition)
{
Game1.ParticleManager.CreateParticle("shockwave", simPosition,
Vector2 displayPosition = ConvertUnits.ToDisplayUnits(simPosition);
Game1.ParticleManager.CreateParticle("shockwave", displayPosition,
Vector2.Zero, 0.0f);
for (int i = 0; i < range * 10; i++)
{
Game1.ParticleManager.CreateParticle("spark", simPosition,
Rand.Vector(Rand.Range(5.0f, 8.0f)), 0.0f);
Game1.ParticleManager.CreateParticle("spark", displayPosition,
Rand.Vector(Rand.Range(500.0f, 800.0f)), 0.0f);
Game1.ParticleManager.CreateParticle("explosionfire", simPosition + Rand.Vector(0.5f),
Rand.Vector(Rand.Range(0.5f, 1.0f)), 0.0f);
Game1.ParticleManager.CreateParticle("explosionfire", displayPosition + Rand.Vector(50f),
Rand.Vector(Rand.Range(50f, 100.0f)), 0.0f);
}
Vector2 displayPosition = ConvertUnits.ToDisplayUnits(simPosition);
float displayRange = ConvertUnits.ToDisplayUnits(range);
light = new LightSource(displayPosition, displayRange, Color.LightYellow);
+13 -13
View File
@@ -244,38 +244,38 @@ namespace Subsurface
{
//UpdateFlowForce();
Vector2 pos = SimPosition;
Vector2 pos = Position;
if (isHorizontal)
{
pos.Y = ConvertUnits.ToSimUnits(MathHelper.Clamp(lowerSurface, rect.Y-rect.Height, rect.Y));
pos.Y = MathHelper.Clamp(lowerSurface, rect.Y - rect.Height, rect.Y);
var particle = Game1.ParticleManager.CreateParticle("watersplash",
new Vector2(pos.X, pos.Y - Rand.Range(0.0f, 0.1f)),
new Vector2(pos.X, pos.Y - Rand.Range(0.0f, 10.0f)),
new Vector2(
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.005f, 0.007f),
flowForce.Y * Rand.Range(0.005f, 0.007f)));
if (particle!=null)
MathHelper.Clamp(flowForce.X, -5000.0f, 5000.0f) * Rand.Range(0.5f, 0.7f),
flowForce.Y * Rand.Range(0.5f, 0.7f)));
if (particle != null)
{
particle.Size = particle.Size * Math.Abs(flowForce.X / 1000.0f);
}
pos.Y = ConvertUnits.ToSimUnits(Rand.Range(lowerSurface, rect.Y - rect.Height));
pos.Y = Rand.Range(lowerSurface, rect.Y - rect.Height);
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
}
else
{
pos.Y += Math.Sign(flowForce.Y) * ConvertUnits.ToSimUnits(rect.Height / 2.0f);
pos.Y += Math.Sign(flowForce.Y) * rect.Height / 2.0f;
for (int i = 0; i < rect.Width; i += (int)Rand.Range(80, 100))
{
pos.X = ConvertUnits.ToSimUnits(Rand.Range(rect.X, rect.X+rect.Width));
pos.X = Rand.Range(rect.X, rect.X + rect.Width);
Subsurface.Particles.Particle splash = Game1.ParticleManager.CreateParticle("watersplash", pos,
new Vector2(flowForce.X * Rand.Range(0.005f, 0.008f), flowForce.Y * Rand.Range(0.005f, 0.008f)));
new Vector2(0, Math.Max(flowForce.Y * Rand.Range(0.5f, 0.8f), 0.0f)));
if (splash!=null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
if (splash != null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
Game1.ParticleManager.CreateParticle("bubbles", pos, flowForce / 2.0f);
}
}
+2 -2
View File
@@ -212,8 +212,8 @@ namespace Subsurface
if (maxDelta > Rand.Range(0.2f,10.0f))
{
Game1.ParticleManager.CreateParticle("mist",
ConvertUnits.ToSimUnits(new Vector2(rect.X + WaveWidth * i,surface + waveY[i])),
new Vector2(0.0f, -0.5f));
new Vector2(rect.X + WaveWidth * i,surface + waveY[i]),
new Vector2(0.0f, -50.0f));
}
waveY[i] = waveY[i] + waveVel[i];
+1 -1
View File
@@ -419,7 +419,7 @@ namespace Subsurface
int i = FindSectionIndex(ConvertUnits.ToDisplayUnits(position));
if (i == -1) return new AttackResult(0.0f, 0.0f);
Game1.ParticleManager.CreateParticle("dustcloud", ConvertUnits.ToSimUnits(SectionPosition(i)), 0.0f, 0.0f);
Game1.ParticleManager.CreateParticle("dustcloud", SectionPosition(i), 0.0f, 0.0f);
if (playSound && !SectionHasHole(i))
{