Mercurial repo for silny-kombat project
Révision | b14c90a93f701cf7721b82b20b479a051f54cb2c (tree) |
---|---|
l'heure | 2022-10-07 03:11:42 |
Auteur | SecT |
Commiter | SecT |
Warning fix in controller
@@ -2,7 +2,7 @@ | ||
2 | 2 | use crate::character::Character; |
3 | 3 | use rust_fsm::TransitionImpossibleError; |
4 | 4 | use crate::character_state_machine; |
5 | -use crate::key_processing; | |
5 | +//use crate::key_processing; | |
6 | 6 | |
7 | 7 | //use crate::key_processing::KeyProcessor; |
8 | 8 |
@@ -164,23 +164,23 @@ | ||
164 | 164 | |
165 | 165 | } |
166 | 166 | |
167 | -pub fn check_collision(characterA: & Character, characterB: & Character) -> bool | |
167 | +pub fn check_collision(character_a: & Character, character_b: & Character) -> bool | |
168 | 168 | { |
169 | 169 | println!("Check collision Enter"); |
170 | 170 | |
171 | 171 | |
172 | - let pos_A : Vector2f = characterA.char_sprite.sprite.position(); | |
173 | - let pos_B : Vector2f = characterB.char_sprite.sprite.position(); | |
172 | + let pos_a: Vector2f = character_a.char_sprite.sprite.position(); | |
173 | + let pos_b: Vector2f = character_b.char_sprite.sprite.position(); | |
174 | 174 | |
175 | 175 | let char_width = 120.0; |
176 | 176 | |
177 | 177 | //println!("checkCollision. A.state: {} B.state: {}", characterA.get_num_state(), characterB.get_num_state() ); |
178 | 178 | |
179 | - let raw_stateA : &character_state_machine::CharacterFSMState = characterA.get_state(); | |
180 | - let raw_stateB : &character_state_machine::CharacterFSMState = characterB.get_state(); | |
179 | + let raw_state_a: &character_state_machine::CharacterFSMState = character_a.get_state(); | |
180 | + let raw_state_b: &character_state_machine::CharacterFSMState = character_b.get_state(); | |
181 | 181 | |
182 | 182 | |
183 | - let stateA:i32 = match raw_stateA { | |
183 | + let state_a:i32 = match raw_state_a { | |
184 | 184 | character_state_machine::CharacterFSMState::StandMoveBack => 2, |
185 | 185 | character_state_machine::CharacterFSMState::StandMoveFront => 1, |
186 | 186 | character_state_machine::CharacterFSMState::StandIdle => 0, |
@@ -189,7 +189,7 @@ | ||
189 | 189 | //None => -1 |
190 | 190 | }; |
191 | 191 | |
192 | - let stateB:i32 = match raw_stateB { | |
192 | + let state_b:i32 = match raw_state_b { | |
193 | 193 | character_state_machine::CharacterFSMState::StandMoveBack => 2, |
194 | 194 | character_state_machine::CharacterFSMState::StandMoveFront => 1, |
195 | 195 | character_state_machine::CharacterFSMState::StandIdle => 0, |
@@ -200,47 +200,47 @@ | ||
200 | 200 | }; |
201 | 201 | |
202 | 202 | |
203 | - println!("checkCollision. A.state: {} B.state: {}", stateA, stateB ); | |
203 | + println!("checkCollision. A.state: {} B.state: {}", state_a, state_b); | |
204 | 204 | |
205 | - if stateA == 1 && stateB == 0 | |
205 | + if state_a == 1 && state_b == 0 | |
206 | 206 | { |
207 | 207 | println!("Check collision A"); |
208 | 208 | //workaround until jumping is not implemented - so characters can't get past each other |
209 | 209 | // return (pos_A.x + 1.0 + char_width - pos_B.x).abs() <= 1.0; |
210 | 210 | } |
211 | 211 | |
212 | - if stateA == 2 && stateB == 0 | |
213 | - { let val = (pos_A.x - 1.0 + char_width - pos_B.x).abs() ; | |
212 | + if state_a == 2 && state_b == 0 | |
213 | + { let val = (pos_a.x - 1.0 + char_width - pos_b.x).abs() ; | |
214 | 214 | println!("Check collision B : {}", val); |
215 | 215 | |
216 | 216 | //return val < 1.0; |
217 | 217 | return val <= 1.0; |
218 | 218 | } |
219 | 219 | |
220 | - if stateA == 0 && stateB == 1 | |
220 | + if state_a == 0 && state_b == 1 | |
221 | 221 | { |
222 | 222 | println!("Check collision C"); |
223 | 223 | |
224 | - return (pos_A.x + char_width - pos_B.x - 1.0).abs() <= 1.0; | |
224 | + return (pos_a.x + char_width - pos_b.x - 1.0).abs() <= 1.0; | |
225 | 225 | } |
226 | 226 | |
227 | - if stateA == 0 && stateB == 2 | |
227 | + if state_a == 0 && state_b == 2 | |
228 | 228 | { |
229 | 229 | println!("Check collision D"); |
230 | 230 | //workaround until jumping is not implemented - so characters can't get past each other |
231 | 231 | //return (pos_A.x + char_width - pos_B.x + 1.0).abs() <= 1.0; |
232 | 232 | } |
233 | 233 | |
234 | - if stateA == 1 && stateB == 2 | |
234 | + if state_a == 1 && state_b == 2 | |
235 | 235 | { |
236 | 236 | println!("Check collision E"); |
237 | 237 | |
238 | - return (pos_A.x + char_width - pos_B.x).abs() <= 10.0; | |
238 | + return (pos_a.x + char_width - pos_b.x).abs() <= 10.0; | |
239 | 239 | } |
240 | 240 | |
241 | - if stateA == 2 && stateB == 1 | |
241 | + if state_a == 2 && state_b == 1 | |
242 | 242 | { |
243 | - let val = (pos_A.x + char_width - pos_B.x ).abs() ; | |
243 | + let val = (pos_a.x + char_width - pos_b.x ).abs() ; | |
244 | 244 | println!("Check collision F : {}", val); |
245 | 245 | |
246 | 246 | //return val < 1.0; |