animation framework stuff
This commit is contained in:
parent
366c5d6543
commit
d277384cc5
4 changed files with 26 additions and 19 deletions
|
|
@ -26,7 +26,7 @@
|
|||
"weight": 0.5,
|
||||
"value": 50,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "particle_line": "*;#53f06d;75.0;#f9ff9f;100.0", "ranged": "12", "healing": "1d4+2" },
|
||||
"effects": { "particle_line": "*;-;#53f06d;75.0;#f9ff9f;100.0", "ranged": "12", "healing": "1d4+2" },
|
||||
"magic": { "class": "uncommon", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
"weight": 0.5,
|
||||
"value": 50,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "particle_line": "*;#00b7ff;75.0;#f4fc83;100.0", "ranged": "12", "damage": "3d4+3" },
|
||||
"effects": { "particle_line": "*;-;#00b7ff;75.0;#f4fc83;100.0", "ranged": "12", "damage": "3d4+3" },
|
||||
"magic": { "class": "uncommon", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
|
|
@ -67,7 +67,7 @@
|
|||
"value": 200,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": {
|
||||
"particle_burst": "*;#FFA500;#000000;600.0;#ff9595;75.0",
|
||||
"particle_burst": "▓;*;~;#FFA500;#000000;500.0;#ffd381;60.0",
|
||||
"ranged": "10",
|
||||
"damage": "8d6",
|
||||
"aoe": "3"
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
"weight": 0.5,
|
||||
"value": 100,
|
||||
"flags": ["CONSUMABLE", "DESTRUCTIBLE"],
|
||||
"effects": { "particle_line": "*;#ad56a6;75.0;#cacaca;100.0", "ranged": "10", "confusion": "4" },
|
||||
"effects": { "particle_line": "*;-;#ad56a6;75.0;#cacaca;100.0", "ranged": "10", "confusion": "4" },
|
||||
"magic": { "class": "uncommon", "naming": "scroll" }
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -413,6 +413,7 @@ pub struct Charges {
|
|||
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||
pub struct SpawnParticleLine {
|
||||
pub glyph: rltk::FontCharType,
|
||||
pub tail_glyph: rltk::FontCharType,
|
||||
pub colour: RGB,
|
||||
pub lifetime_ms: f32,
|
||||
pub trail_colour: RGB,
|
||||
|
|
@ -429,6 +430,8 @@ pub struct SpawnParticleSimple {
|
|||
#[derive(Component, Serialize, Deserialize, Clone)]
|
||||
pub struct SpawnParticleBurst {
|
||||
pub glyph: rltk::FontCharType,
|
||||
pub head_glyph: rltk::FontCharType,
|
||||
pub tail_glyph: rltk::FontCharType,
|
||||
pub colour: RGB,
|
||||
pub lerp: RGB,
|
||||
pub lifetime_ms: f32,
|
||||
|
|
|
|||
|
|
@ -40,11 +40,12 @@ pub fn handle_burst_particles(ecs: &World, entity: Entity, target: &Targets) {
|
|||
start_pos,
|
||||
end_pos,
|
||||
&SpawnParticleLine {
|
||||
glyph: part.glyph,
|
||||
glyph: part.head_glyph,
|
||||
tail_glyph: part.tail_glyph,
|
||||
colour: part.colour,
|
||||
trail_colour: part.colour,
|
||||
trail_colour: part.trail_colour,
|
||||
lifetime_ms: part.trail_lifetime_ms, // 75.0 is good here.
|
||||
trail_lifetime_ms: part.trail_lifetime_ms + 25.0,
|
||||
trail_lifetime_ms: part.trail_lifetime_ms,
|
||||
},
|
||||
);
|
||||
let map = ecs.fetch::<Map>();
|
||||
|
|
@ -53,7 +54,7 @@ pub fn handle_burst_particles(ecs: &World, entity: Entity, target: &Targets) {
|
|||
Point::new(start_pos % map.width, start_pos / map.width),
|
||||
Point::new(end_pos % map.width, end_pos / map.width),
|
||||
);
|
||||
let burst_delay = line.len() as f32 * 75.0;
|
||||
let burst_delay = line.len() as f32 * part.trail_lifetime_ms;
|
||||
for i in 0..10 {
|
||||
add_effect(
|
||||
None,
|
||||
|
|
@ -62,7 +63,7 @@ pub fn handle_burst_particles(ecs: &World, entity: Entity, target: &Targets) {
|
|||
fg: part.colour.lerp(part.lerp, i as f32 * 0.1),
|
||||
bg: RGB::named(BLACK),
|
||||
lifespan: part.lifetime_ms / 10.0, // ~50-80 is good here.
|
||||
delay: burst_delay + (i as f32 * part.lifetime_ms / 10.0),
|
||||
delay: burst_delay + (i as f32 * part.lifetime_ms / 10.0), // above + burst_delay
|
||||
},
|
||||
target.clone(),
|
||||
);
|
||||
|
|
@ -148,7 +149,7 @@ fn spawn_line_particles(ecs: &World, start: i32, end: i32, part: &SpawnParticleL
|
|||
add_effect(
|
||||
None,
|
||||
EffectType::Particle {
|
||||
glyph: to_cp437('-'),
|
||||
glyph: part.tail_glyph,
|
||||
fg: part.trail_colour,
|
||||
bg: RGB::named(BLACK),
|
||||
lifespan: part.trail_lifetime_ms,
|
||||
|
|
|
|||
|
|
@ -883,10 +883,11 @@ fn parse_particle_line(n: &str) -> SpawnParticleLine {
|
|||
let tokens: Vec<_> = n.split(';').collect();
|
||||
SpawnParticleLine {
|
||||
glyph: to_cp437(tokens[0].chars().next().unwrap()),
|
||||
colour: RGB::from_hex(tokens[1]).expect("Invalid RGB"),
|
||||
lifetime_ms: tokens[2].parse::<f32>().unwrap(),
|
||||
trail_colour: RGB::from_hex(tokens[3]).expect("Invalid trail RGB"),
|
||||
trail_lifetime_ms: tokens[4].parse::<f32>().unwrap(),
|
||||
tail_glyph: to_cp437(tokens[1].chars().next().unwrap()),
|
||||
colour: RGB::from_hex(tokens[2]).expect("Invalid RGB"),
|
||||
lifetime_ms: tokens[3].parse::<f32>().unwrap(),
|
||||
trail_colour: RGB::from_hex(tokens[4]).expect("Invalid trail RGB"),
|
||||
trail_lifetime_ms: tokens[5].parse::<f32>().unwrap(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -903,10 +904,12 @@ fn parse_particle_burst(n: &str) -> SpawnParticleBurst {
|
|||
let tokens: Vec<_> = n.split(';').collect();
|
||||
SpawnParticleBurst {
|
||||
glyph: to_cp437(tokens[0].chars().next().unwrap()),
|
||||
colour: RGB::from_hex(tokens[1]).expect("Invalid RGB"),
|
||||
lerp: RGB::from_hex(tokens[2]).expect("Invalid LERP RGB"),
|
||||
lifetime_ms: tokens[3].parse::<f32>().unwrap(),
|
||||
trail_colour: RGB::from_hex(tokens[4]).expect("Invalid trail RGB"),
|
||||
trail_lifetime_ms: tokens[5].parse::<f32>().unwrap(),
|
||||
head_glyph: to_cp437(tokens[1].chars().next().unwrap()),
|
||||
tail_glyph: to_cp437(tokens[2].chars().next().unwrap()),
|
||||
colour: RGB::from_hex(tokens[3]).expect("Invalid RGB"),
|
||||
lerp: RGB::from_hex(tokens[4]).expect("Invalid LERP RGB"),
|
||||
lifetime_ms: tokens[5].parse::<f32>().unwrap(),
|
||||
trail_colour: RGB::from_hex(tokens[6]).expect("Invalid trail RGB"),
|
||||
trail_lifetime_ms: tokens[7].parse::<f32>().unwrap(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue