Skip to content

Commit dcdd4b4

Browse files
committed
More smoke effects tweaking
1 parent 20f9773 commit dcdd4b4

File tree

6 files changed

+136
-8
lines changed

6 files changed

+136
-8
lines changed

assets/test.map

+24
Original file line numberDiff line numberDiff line change
@@ -2410,3 +2410,27 @@
24102410
( 936 -536 4 ) ( 936 -536 5 ) ( 936 -535 4 ) test/WALLF 0 0 0 1 1
24112411
}
24122412
}
2413+
// entity 59
2414+
{
2415+
"classname" "monster_alien"
2416+
"origin" "416 -260 24"
2417+
"hostile" "true"
2418+
}
2419+
// entity 60
2420+
{
2421+
"classname" "monster_alien"
2422+
"origin" "376 -204 24"
2423+
"hostile" "true"
2424+
}
2425+
// entity 61
2426+
{
2427+
"classname" "monster_alien"
2428+
"origin" "240 -180 24"
2429+
"hostile" "true"
2430+
}
2431+
// entity 62
2432+
{
2433+
"classname" "monster_alien"
2434+
"origin" "240 -252 24"
2435+
"hostile" "true"
2436+
}

entities/actor_stats.zig

+30-4
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,18 @@ pub const ActorStats = struct {
183183
._spritesheet = spritesheets.getSpriteSheet("sprites/particles"),
184184
.spritesheet_row = 3,
185185
.spritesheet_col = 2,
186-
.lifetime = 16.0,
186+
.lifetime = 26.0,
187187
.lifetime_variance = 3.0,
188188
// .velocity = math.Vec3.zero,
189189
.velocity = hit_normal.scale(0.3),
190190
.velocity_variance = math.Vec3.one.scale(0.4),
191-
.position_variance = math.Vec3.one.scale(0.5),
191+
.position_offset = hit_normal.scale(-0.3),
192+
.position_variance = math.Vec3.one.scale(0.2),
192193
.gravity = 0.001,
193194
.color = delve.colors.Color.new(1.0, 0.0, 0.0, 0.25),
194195
.end_color = delve.colors.Color.new(1.0, 0.0, 0.0, 0.0),
195-
.scale = 1.35,
196-
.end_scale = 1.65,
196+
.scale = 1.55,
197+
.end_scale = 1.75,
197198
.delete_owner_when_done = false,
198199
.use_lighting = true,
199200
.collides_world = false,
@@ -246,5 +247,30 @@ pub const ActorStats = struct {
246247
}) catch {
247248
return;
248249
};
250+
251+
// blood mist (smoke!)
252+
_ = hit_emitter.createNewComponent(emitter.ParticleEmitterComponent, .{
253+
.num = 4,
254+
.num_variance = 5,
255+
._spritesheet = spritesheets.getSpriteSheet("sprites/particles"),
256+
.spritesheet_row = 3,
257+
.spritesheet_col = 2,
258+
.lifetime = 26.0,
259+
.lifetime_variance = 3.0,
260+
.velocity = hit_normal.scale(0.5),
261+
.velocity_variance = math.Vec3.one.scale(0.4),
262+
.position_offset = hit_normal.scale(-0.3),
263+
.position_variance = math.Vec3.one.scale(2.0),
264+
.gravity = 0.001,
265+
.color = delve.colors.Color.new(1.0, 0.0, 0.0, 0.25),
266+
.end_color = delve.colors.Color.new(1.0, 0.0, 0.0, 0.0),
267+
.scale = 2.35,
268+
.end_scale = 2.65,
269+
.delete_owner_when_done = false,
270+
.use_lighting = true,
271+
.collides_world = false,
272+
}) catch {
273+
return;
274+
};
249275
}
250276
};

entities/breakable.zig

+28
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const math = delve.math;
1414
pub const BreakableComponent = struct {
1515
// properties
1616
breaks_on_trigger: bool = true,
17+
make_smoke: bool = true,
18+
smoke_color: delve.colors.Color = delve.colors.Color.new(0.3, 0.3, 0.3, 1.0),
1719

1820
// interface
1921
owner: entities.Entity = entities.InvalidEntity,
@@ -97,6 +99,32 @@ pub const BreakableComponent = struct {
9799
}) catch {
98100
return;
99101
};
102+
103+
// smoke!
104+
if (self.make_smoke) {
105+
_ = vfx.createNewComponent(emitter.ParticleEmitterComponent, .{
106+
.num = 4,
107+
.num_variance = 2,
108+
.spritesheet = string.String.init("sprites/particles"),
109+
.spritesheet_row = 3,
110+
.spritesheet_col = 2,
111+
.lifetime = 32.0,
112+
.lifetime_variance = 4.0,
113+
.velocity = math.Vec3.zero,
114+
.velocity_variance = math.Vec3.one.scale(0.75),
115+
.position_variance = size,
116+
.gravity = 0.001,
117+
.color = self.smoke_color,
118+
.end_color = self.smoke_color.mul(delve.colors.Color.new(1.0, 1.0, 1.0, 0.0)),
119+
.scale = 2.0,
120+
.end_scale = 2.5,
121+
.delete_owner_when_done = false,
122+
.use_lighting = true,
123+
.collides_world = false,
124+
}) catch {
125+
return;
126+
};
127+
}
100128
}
101129
};
102130

entities/explosion.zig

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ pub const ExplosionComponent = struct {
217217
._spritesheet = spritesheets.getSpriteSheet("sprites/particles"),
218218
.spritesheet_row = 3,
219219
.spritesheet_col = 2,
220-
.lifetime = 22.0,
221-
.lifetime_variance = 3.0,
220+
.lifetime = 32.0,
221+
.lifetime_variance = 4.0,
222222
.velocity = math.Vec3.zero,
223223
.velocity_variance = math.Vec3.one.scale(0.75),
224224
.position_variance = math.Vec3.one.scale(0.5),

entities/projectile.zig

+24
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,28 @@ pub fn playWeaponWaterHitEffects(world: *entities.World, attack_normal: math.Vec
348348
}) catch {
349349
return;
350350
};
351+
352+
// smoke!
353+
_ = hit_emitter.createNewComponent(emitter.ParticleEmitterComponent, .{
354+
.num = 4,
355+
.num_variance = 2,
356+
.spritesheet = string.String.init("sprites/particles"),
357+
.spritesheet_row = 3,
358+
.spritesheet_col = 2,
359+
.lifetime = 3.0,
360+
.lifetime_variance = 3.0,
361+
.velocity = math.Vec3.zero,
362+
.velocity_variance = math.Vec3.one.scale(0.75),
363+
.position_variance = math.Vec3.one,
364+
.gravity = 0.001,
365+
.color = delve.colors.cyan,
366+
.end_color = delve.colors.cyan.mul(delve.colors.Color.new(1.0, 1.0, 1.0, 0.0)),
367+
.scale = 1.5,
368+
.end_scale = 1.75,
369+
.delete_owner_when_done = false,
370+
.use_lighting = true,
371+
.collides_world = false,
372+
}) catch {
373+
return;
374+
};
351375
}

entities/weapon.zig

+28-2
Original file line numberDiff line numberDiff line change
@@ -459,10 +459,12 @@ pub fn playWeaponWorldHitEffects(world: *entities.World, attack_normal: math.Vec
459459
._spritesheet = spritesheets.getSpriteSheet("sprites/particles"),
460460
.spritesheet_row = 3,
461461
.spritesheet_col = 2,
462-
.lifetime = 20.0,
463-
.lifetime_variance = 2.0,
462+
.lifetime = 30.0,
463+
.lifetime_variance = 4.0,
464464
.velocity = hit_normal.scale(0.3),
465465
.velocity_variance = math.Vec3.one.scale(0.4),
466+
.position_offset = hit_normal.scale(0.25),
467+
.position_variance = math.Vec3.one.scale(0.15),
466468
.gravity = 0.001,
467469
.color = delve.colors.Color.new(1.0, 1.0, 1.0, 0.25),
468470
.end_color = delve.colors.Color.new(1.0, 1.0, 1.0, 0.0),
@@ -591,6 +593,30 @@ pub fn playWeaponWaterHitEffects(world: *entities.World, attack_normal: math.Vec
591593
}) catch {
592594
return;
593595
};
596+
597+
// smoke!
598+
_ = hit_emitter.createNewComponent(emitter.ParticleEmitterComponent, .{
599+
.num = 4,
600+
.num_variance = 2,
601+
.spritesheet = string.String.init("sprites/particles"),
602+
.spritesheet_row = 3,
603+
.spritesheet_col = 2,
604+
.lifetime = 3.0,
605+
.lifetime_variance = 3.0,
606+
.velocity = math.Vec3.zero,
607+
.velocity_variance = math.Vec3.one.scale(0.75),
608+
.position_variance = math.Vec3.one,
609+
.gravity = 0.001,
610+
.color = delve.colors.cyan,
611+
.end_color = delve.colors.cyan.mul(delve.colors.Color.new(1.0, 1.0, 1.0, 0.0)),
612+
.scale = 1.5,
613+
.end_scale = 1.75,
614+
.delete_owner_when_done = false,
615+
.use_lighting = true,
616+
.collides_world = false,
617+
}) catch {
618+
return;
619+
};
594620
}
595621

596622
pub fn getAmmoTypeForWeaponType(weapon_type: WeaponType) AmmoType {

0 commit comments

Comments
 (0)