Struct catchit::Engine
[−]
[src]
pub struct Engine { // some fields omitted }
The engine implements the game logic
It relies on user input given as 2d coordinates
Methods
impl Engine
fn from_field(field: Extent) -> Engine
fn reset(&mut self, field: Extent)
Reset the engine to use the given game-state. Can be used to setup a new game as well.
fn update(&mut self, dt: f64) -> Result<(), State>
Update the game state.
If the returned value is the last game-state, it indicates that the player is game-over.
fn state(&self) -> &Option<State>
fn set_hunter_pos(&mut self, pos: Position)
Position will be clamped into the playing field
fn set_hunter_force(&mut self, enabled: bool)
If enabled, a forcefield is created around the hunter, usually repelling spheres.