• R/O
  • SSH

silny-kombat: Commit

Mercurial repo for silny-kombat project


Commit MetaInfo

Révision8c381616eb278d88a05306785935ddc41d3901fc (tree)
l'heure2022-01-13 05:10:43
AuteurSecT
CommiterSecT

Message de Log

Set the ground level

Change Summary

Modification

diff -r dfe0c0726865 -r 8c381616eb27 silny-kombat_integration_tests/src/main.rs
--- a/silny-kombat_integration_tests/src/main.rs Thu Nov 25 21:05:48 2021 +0100
+++ b/silny-kombat_integration_tests/src/main.rs Wed Jan 12 21:10:43 2022 +0100
@@ -107,41 +107,46 @@
107107 pub fn check_test_results(A_x_min: i32, A_x_max: i32, B_x_min: i32, B_x_max: i32) ->bool{
108108
109109 let values: Vec<i32> = get_test_values_from_dump_file();
110+ //[groundLevel, Ax,Ay, Bx, By]
110111
111112 for value in & values {
112113 println!("value: {}", value)
113114 }
114115
116+
117+ let groundLevel = values[0];
118+
115119 // let A_x_min = 55;
116120 // let A_x_max = 65;
117121 //
118122 // let B_x_min = 535;
119123 // let B_x_max = 545;
120124
125+ let startOfCharCoordinateData=1;
121126
122- if values.len() >= 4 {
127+ if values.len() >= 5 {
123128
124129 //Character A, X value
125- if values[0] < A_x_min || values[0] > A_x_max {
126- println!("FAIL values[0]: {}", values[0]);
130+ if values[startOfCharCoordinateData+0] < A_x_min || values[startOfCharCoordinateData+0] > A_x_max {
131+ println!("FAIL values[0]: {}", values[startOfCharCoordinateData+0]);
127132 return false;
128133 }
129134
130135 //Character A, Y value
131- if values[1] != 0 {
132- println!("FAIL values[1]: {}", values[1]);
136+ if values[startOfCharCoordinateData+1] != groundLevel+0 {
137+ println!("FAIL values[1]: {}", values[startOfCharCoordinateData+1]);
133138 return false;
134139 }
135140
136141 //Character B, X value
137- if values[2] < B_x_min || values[2] > B_x_max {
138- println!("FAIL values[2]: {}", values[2]);
142+ if values[startOfCharCoordinateData+2] < B_x_min || values[startOfCharCoordinateData+2] > B_x_max {
143+ println!("FAIL values[2]: {}", values[startOfCharCoordinateData+2]);
139144 return false;
140145 }
141146
142147 //Character B, Y value
143- if values[3] != 0 {
144- println!("FAIL values[3]: {}", values[3]);
148+ if values[startOfCharCoordinateData+3] != groundLevel+0 {
149+ println!("FAIL values[3]: {}", values[startOfCharCoordinateData+3]);
145150 return false;
146151 }
147152
diff -r dfe0c0726865 -r 8c381616eb27 src/controller.rs
--- a/src/controller.rs Thu Nov 25 21:05:48 2021 +0100
+++ b/src/controller.rs Wed Jan 12 21:10:43 2022 +0100
@@ -72,7 +72,11 @@
7272
7373 println!("{} vs {}", character_A.get_name(), character_B.get_name());
7474
75- character_B.char_sprite.sprite.set_position(Vector2f::new(600.0, 0.0));
75+ let groundLevel = 100.0;
76+
77+ character_A.char_sprite.sprite.set_position(Vector2f::new(0.0, groundLevel + 0.0));
78+
79+ character_B.char_sprite.sprite.set_position(Vector2f::new(600.0, groundLevel + 0.0));
7680 character_B.char_sprite.sprite.set_scale(Vector2f::new(-1.0, 1.0));
7781
7882 //loop
@@ -91,7 +95,7 @@
9195 if key_result == 99 {
9296 //testing
9397 println!("Testing: dump values to check");
94- save_test_data_to_file(&character_A.char_sprite, &character_B.char_sprite);
98+ save_test_data_to_file(groundLevel, &character_A.char_sprite, &character_B.char_sprite);
9599 }
96100
97101
@@ -209,12 +213,14 @@
209213 }
210214 }
211215
212-pub fn save_test_data_to_file(spriteA: &CharacterSprite, spriteB: &CharacterSprite)
216+pub fn save_test_data_to_file(groundLevel:f32, spriteA: &CharacterSprite, spriteB: &CharacterSprite)
213217 {
214218 let mut data_to_dump: String = "spriteAData\n".to_string();
215219
216220 //data_to_dump = &String::from("spriteAData");
217221
222+ data_to_dump.push_str(&groundLevel.to_string());
223+ data_to_dump.push_str("\n");
218224 data_to_dump.push_str( &spriteA.sprite.position().x.to_string());
219225 data_to_dump.push_str("\n");
220226 data_to_dump.push_str( &spriteA.sprite.position().y.to_string());
diff -r dfe0c0726865 -r 8c381616eb27 src/main.rs
--- a/src/main.rs Thu Nov 25 21:05:48 2021 +0100
+++ b/src/main.rs Wed Jan 12 21:10:43 2022 +0100
@@ -64,6 +64,8 @@
6464
6565 //data_to_dump = &String::from("spriteAData");
6666
67+
68+
6769 data_to_dump.push_str( &sprite_a.sprite.position().x.to_string());
6870 data_to_dump.push_str("\n");
6971 data_to_dump.push_str( &sprite_a.sprite.position().y.to_string());
Afficher sur ancien navigateur de dépôt.