Module fruit

Source
Expand description

§Fruit Management Module

This module defines the Fruit struct, which represents different fruits in the game logic and provides the ability to create, position, and render them.

The FRUITS_SCORES_PROBABILITIES constant defines various fruits with their respective scores and spawn probabilities.

§Example

use rsnaker::graphics::sprites::fruit::Fruit;
use rsnaker::graphics::graphic_block::Position;

let position = Position { x: 5, y: 10 };
let apple = Fruit::new(40, 2,position, "🍎");
assert_eq!(apple.get_score(), 40);

Structs§

Fruit
Represents a fruit on the map. Fruits have a score value and are displayed as graphical blocks.

Constants§

FRUITS_SCORES_PROBABILITIES
Distribution statistics with weighted lottery / pie chart parts. image, score, probability, size effect