pub fn random_circle(radius: f32) -> Vec2Examples found in repository?
examples/single_particle.rs (line 14)
5fn update(_c: &mut EngineContext) {
6 // We only want to spawn a particle once every 100ms.
7 // Comfy provides a comfy way of doing ad-hoc timers with `Cooldowns`.
8 //
9 // A cooldown is identified by a string key and automatically ticked
10 // by the engine.
11 if cooldowns().can_use("spawn-particle", 0.1) {
12 // Particles are automatically simulated once they're spawned.
13 spawn_particle(Particle {
14 position: random_circle(5.0),
15 size: splat(1.0),
16 velocity: 0.0,
17 velocity_end: 20.0,
18 ..Default::default()
19 });
20 }
21}