INNER CODE UNIT · Rust

has_collision

OpenGMK/OpenGMK · gm8decompiler/src/collision.rs:62

                    let has_collision = *map.data.get((y * map.width + x) as usize)?;
                    let alpha = alpha_at(&frame, x, y)?;
                    if has_collision && (alpha < lowest_alpha_with_col) {
                        lowest_alpha_with_col = alpha;
                    } else if !has_collision && (alpha > highest_alpha_no_col) {
                        highest_alpha_no_col = alpha;
                    }
                }
            } else {
                // Not per-frame colliders - the highest alpha value from each pixel is used
                let map = sprite.colliders.first()?;
                let alpha = sprite
                    .frames
                    .iter()
                    .map(|f| alpha_at(f, x, y).map(|a| (f, a)))
                    .flatten()
                    .max_by(|(_, a1), (_, a2)| a1.cmp(&a2))?
                    .1;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…