• R/O
  • SSH

silny-kombat: Commit

Mercurial repo for silny-kombat project


Commit MetaInfo

Revision1373908174ca026891ec3883b95c35ad760001d9 (tree)
Time2022-02-10 05:38:31
AuthorSecT
CommiterSecT

Log Message

Refactoring - using States enums for sprite_rendering

Change Summary

Incremental Difference

diff -r c71e72ed4f16 -r 1373908174ca src/sprite_rendering.rs
--- a/src/sprite_rendering.rs Wed Feb 09 21:26:52 2022 +0100
+++ b/src/sprite_rendering.rs Wed Feb 09 21:38:31 2022 +0100
@@ -8,7 +8,9 @@
88 };
99
1010 enum States {
11- Idle
11+ Idle,
12+ MovingRight,
13+ MovingLeft
1214 }
1315
1416 pub struct CharacterSprite<'a> {
@@ -61,7 +63,7 @@
6163 {
6264 self.sprite.set_texture(&self.textures[0], true);
6365 }
64- } else if state == 1
66+ } else if state == States::MovingRight as i32
6567 {
6668 self.move_right();
6769 if self.counter % 10 == 0
@@ -72,7 +74,7 @@
7274 {
7375 self.sprite.set_texture(&self.textures[3], true);
7476 }
75- } else if state == 2
77+ } else if state == States::MovingLeft as i32
7678 {
7779 self.move_left();
7880 if self.counter % 10 == 0
Show on old repository browser