Improved hit particles

This commit is contained in:
Joshua Barretto 2021-03-29 01:06:30 +01:00
parent b0acbda236
commit 8f3233365d
3 changed files with 16 additions and 9 deletions

View File

@ -63,6 +63,7 @@ const int ICE = 21;
const int LIFESTEAL_BEAM = 22;
const int CULTIST_FLAME = 23;
const int STATIC_SMOKE = 24;
const int BLOOD = 25;
// meters per second squared (acceleration)
const float earth_gravity = 9.807;
@ -211,10 +212,10 @@ void main() {
attr = Attr(
linear_motion(
vec3(0),
normalize(vec3(rand4, rand5, rand6)) * 30.0 + grav_vel(earth_gravity)
normalize(vec3(rand4, rand5, rand6)) * 20.0 + grav_vel(earth_gravity)
),
vec3(2.0 + rand0),
vec4(vec3(0.6 + rand7 * 0.4), 1),
vec3(1),
vec4(vec3(0.25), 1),
spin_in_axis(vec3(1,0,0),0)
);
} else if (inst_mode == FIREWORK_BLUE) {
@ -410,6 +411,16 @@ void main() {
vec4(1.0),
spin_in_axis(vec3(rand6, rand7, rand8), rand9)
);
} else if (inst_mode == BLOOD) {
attr = Attr(
linear_motion(
vec3(0),
normalize(vec3(rand4, rand5, rand6)) * 5.0 + grav_vel(earth_gravity)
),
vec3((2.0 * (1 - slow_start(0.8)))),
vec4(1, 0, 0, 1),
spin_in_axis(vec3(1,0,0),0)
);
} else {
attr = Attr(
linear_motion(

View File

@ -121,6 +121,7 @@ pub enum ParticleMode {
LifestealBeam = 22,
CultistFlame = 23,
StaticSmoke = 24,
Blood = 25,
}
impl ParticleMode {

View File

@ -199,12 +199,7 @@ impl ParticleMgr {
Outcome::ProjectileHit { pos, target, .. } => {
if target.is_some() {
self.particles.resize_with(self.particles.len() + 30, || {
Particle::new(
Duration::from_millis(100),
time,
ParticleMode::Shrapnel,
*pos,
)
Particle::new(Duration::from_millis(250), time, ParticleMode::Blood, *pos)
});
}
},