docs: minor documentation commentsa cross project

This commit is contained in:
2025-07-22 12:03:16 -05:00
parent f51a3ddeb0
commit f540dc5373
8 changed files with 165 additions and 29 deletions

View File

@@ -1,11 +1,16 @@
//! This module defines the `Entity` trait, which is implemented by all game
//! objects that can be moved and rendered.
/// A trait for game objects that can be moved and rendered.
pub trait Entity {
// Returns true if the entity is colliding with the other entity
/// Returns true if the entity is colliding with the other entity.
fn is_colliding(&self, other: &dyn Entity) -> bool;
// Returns the absolute position of the entity
/// Returns the absolute position of the entity, in pixels.
fn position(&self) -> (i32, i32);
// Returns the cell position of the entity (XY position within the grid)
/// Returns the cell position of the entity, in grid coordinates.
fn cell_position(&self) -> (u32, u32);
/// Returns the position of the entity within its current cell, in pixels.
fn internal_position(&self) -> (u32, u32);
// Tick the entity (move it, perform collision checks, etc)
/// Ticks the entity, which updates its state and position.
fn tick(&mut self);
}