Tower shots start at the tower top (arrow battlements, cannon muzzle, magic orb)

Effects now carry start/end heights; leftover 2D height offsets that moved
projectiles and hit sparks sideways on the map are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-03 10:04:46 +01:00
1 parent 4d1bf30586
commit 6f037294c0
2 files changed
+54 -23

No files matched your search

+4 -8
View File
@@ -1099,11 +1099,7 @@ impl R3d {
// ------------------------------------------------------------------ towers
pub fn tower_height(t: &Tower) -> f32 {
match t.kind {
TowerKind::Arrow => 1.0 + 0.3 * (t.level - 1) as f32,
TowerKind::Cannon => 0.6 + 0.15 * (t.level - 1) as f32,
TowerKind::Magic => 1.2 + 0.3 * (t.level - 1) as f32,
}
t.top()
}
fn shade_c(r: u8, g: u8, b: u8, f: f32) -> Color {
@@ -1301,11 +1297,11 @@ fn draw_fx(f: &Fx, t: f32) {
let p = (f.t / f.max).clamp(0.0, 1.0);
let c = rgba(f.col);
let a = |alpha: f32| Color::new(c.r, c.g, c.b, alpha);
let at = vec3(f.x, 0.4, f.y);
let at = vec3(f.x, f.h, f.y);
match f.kind {
0 => {
let from = vec3(f.x, 0.45, f.y);
let to = vec3(f.x2, 0.45, f.y2);
let from = vec3(f.x, f.h, f.y);
let to = vec3(f.x2, f.h2, f.y2);
let head = from.lerp(to, p);
let tail = from.lerp(to, (p - 0.35).max(0.0));
line3(tail, head, 0.06, a(0.8));