From e4aae7680926d5023a22776d0c332d22c735b034 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 25 Sep 2024 00:31:43 +0200 Subject: tc: particle hue --- test-client/main.ts | 2 +- test-client/particles.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'test-client') diff --git a/test-client/main.ts b/test-client/main.ts index 09e1c99a..3568244e 100644 --- a/test-client/main.ts +++ b/test-client/main.ts @@ -335,7 +335,7 @@ function keyboard(ev: KeyboardEvent, down: boolean) { if (!keys_down.has(KEY_INTERACT) && ev.code == KEY_INTERACT && down) set_interact(true) if (keys_down.has(KEY_INTERACT) && ev.code == KEY_INTERACT && !down) set_interact(false) if (down && ev.code in QUICK_COMMANDS) send({ player: my_id, type: "communicate", message: { text: QUICK_COMMANDS[ev.code] } }) - if (down && ev.code == "KeyE") particle_splash(get_interact_target() ?? { x: 0, y: 0 }) + if (down && ev.code == "KeyE") particle_splash(get_interact_target() ?? { x: 0, y: 0 }, 0.8) if (down) keys_down.add(ev.code) else keys_down.delete(ev.code) } diff --git a/test-client/particles.ts b/test-client/particles.ts index ba695cc0..e84e9c91 100644 --- a/test-client/particles.ts +++ b/test-client/particles.ts @@ -14,7 +14,7 @@ export function draw_particles() { } export function particle_count() { return particles.size } -export function particle_splash(pos: V2) { +export function particle_splash(pos: V2, hue: number) { for (let i = 0; i < 64; i++) { const p = new Particle() p.px = pos.x + 0.5 @@ -25,7 +25,7 @@ export function particle_splash(pos: V2) { p.vy = Math.cos(a) * r p.decay = 4. p.tr = Math.sqrt(Math.random()) * 1. - p.c = `hsl(${Math.random() * 0.2 + 0.7}turn, 100%, 50%)` + p.c = `hsl(${Math.random() * 0.2 - 0.1 + hue}turn, 100%, 50%)` p.r = Math.random() * 0.1 + 0.03 particles.add(p) } -- cgit v1.2.3-70-g09d2