Skip to main content

OverworldCollision

Trait OverworldCollision 

Source
pub trait OverworldCollision {
    // Required method
    fn is_blocked(&self, x: i32, y: i32) -> bool;

    // Provided method
    fn is_blocked_at(&self, level: u8, x: i32, y: i32) -> bool { ... }
}
Expand description

The minimum a map must answer for the actor to move: is walking onto (x, y) blocked? Out-of-bounds should return true (enclosed world). Callers fold in dynamic collision (NPC tiles, locked doors) by composing it into this impl.

Required Methods§

Source

fn is_blocked(&self, x: i32, y: i32) -> bool

Provided Methods§

Source

fn is_blocked_at(&self, level: u8, x: i32, y: i32) -> bool

Elevation-aware form of is_blocked: is walking onto (x, y) blocked at elevation level? The default ignores the level (single-level maps behave exactly as before); multi-level maps override it to answer from the per-level collision grid.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§