Skip to content

BWbwchen/RustSnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Snake Game

A snake game in rust with well-structed code.

Architecture of code

The game is mainly controlled by struct Game , and based on struct Block.

struct Game {
    snake: snake::Snake,
    food: food::Food,
    background: background::BackGround,
}
struct Snake {
    body: VecDeque<Block>,
    direction: Direction,
    add_len: bool,
}
struct Food {
    f: Block,
}
struct Block {
    x: usize,
    y: usize,
}
struct BackGround {
    map: [[Block; WIDTH]; HEIGHT],
}

About

A snake game with well-structed code in rust.

Topics

Resources

Stars

Watchers

Forks

Languages