1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//! # Game graphical Modules
//! This module contains the core components of the game logic, it includes the following submodules:
//!
//! - [`graphic_block`]: Handles the graphical rendering of game logic blocks in the terminal.
//! - [`sprites`]: Provides the game sprites, as snake, map and so on. .
//! - [`menus`]: Provides utility functions to assist with common texts and graphical tasks
/* Just to have some fun with moving letter
pub fn left(&mut self) {
let mut current: u16 = self.body[0].x;
self.body[0].x -= self.CASE_SIZE;
let mut previous: u16 = current;
for i in 1..self.body.len() {
current = self.body[i].x;
self.body[i].x = previous;
previous = current;
}
}
pub fn right(&mut self) {
let mut current: u16 = self.body[0].x;
self.body[0].x += self.CASE_SIZE;
let mut previous: u16 = current;
for i in 1..self.body.len() {
current = self.body[i].x;
self.body[i].x = previous;
previous = current;
}
}
pub fn up(&mut self) {
let mut current: u16 = self.body[0].y;
self.body[0].y -= self.CASE_SIZE / 2;
let mut previous: u16 = current;
for i in 1..self.body.len() {
current = self.body[i].y;
self.body[i].y = previous;
previous = current;
}
}
pub fn down(&mut self) {
let mut current: u16 = self.body[0].y;
self.body[0].y += self.CASE_SIZE / 2;
let mut previous: u16 = current;
for i in 1..self.body.len() {
current = self.body[i].y;
self.body[i].y = previous;
previous = current;
}
}
*/