rsnaker/graphics/sprites/mod.rs
1//! This module contains the core components of the game logic, it includes the following sub-modules:
2//!
3//! - [`fruit`]: Represents the fruit element, including its position, score, and image.
4//! - [`map`]: Manages the game logic map, layout, and boundaries.
5//! - [`snake_body`]: Tracks and manages the snake's body and its movement.
6pub mod fruit;
7
8pub mod map;
9
10pub mod snake_body;
11
12/* Just to have some fun with moving letter
13pub fn left(&mut self) {
14 let mut current: u16 = self.body[0].x;
15 self.body[0].x -= self.CASE_SIZE;
16 let mut previous: u16 = current;
17 for i in 1..self.body.len() {
18 current = self.body[i].x;
19 self.body[i].x = previous;
20 previous = current;
21 }
22 }
23 pub fn right(&mut self) {
24 let mut current: u16 = self.body[0].x;
25 self.body[0].x += self.CASE_SIZE;
26 let mut previous: u16 = current;
27 for i in 1..self.body.len() {
28 current = self.body[i].x;
29 self.body[i].x = previous;
30 previous = current;
31 }
32 }
33 pub fn up(&mut self) {
34 let mut current: u16 = self.body[0].y;
35 self.body[0].y -= self.CASE_SIZE / 2;
36 let mut previous: u16 = current;
37 for i in 1..self.body.len() {
38 current = self.body[i].y;
39 self.body[i].y = previous;
40 previous = current;
41 }
42 }
43 pub fn down(&mut self) {
44 let mut current: u16 = self.body[0].y;
45 self.body[0].y += self.CASE_SIZE / 2;
46 let mut previous: u16 = current;
47 for i in 1..self.body.len() {
48 current = self.body[i].y;
49 self.body[i].y = previous;
50 previous = current;
51 }
52 }
53 */