• R/O
  • SSH

silny-kombat: Commit

Mercurial repo for silny-kombat project


Commit MetaInfo

Révisionb14c90a93f701cf7721b82b20b479a051f54cb2c (tree)
l'heure2022-10-07 03:11:42
AuteurSecT
CommiterSecT

Message de Log

Warning fix in controller

Change Summary

Modification

diff -r 91d6889c64e5 -r b14c90a93f70 src/controller.rs
--- a/src/controller.rs Thu Oct 06 19:58:01 2022 +0200
+++ b/src/controller.rs Thu Oct 06 20:11:42 2022 +0200
@@ -2,7 +2,7 @@
22 use crate::character::Character;
33 use rust_fsm::TransitionImpossibleError;
44 use crate::character_state_machine;
5-use crate::key_processing;
5+//use crate::key_processing;
66
77 //use crate::key_processing::KeyProcessor;
88
@@ -164,23 +164,23 @@
164164
165165 }
166166
167-pub fn check_collision(characterA: & Character, characterB: & Character) -> bool
167+pub fn check_collision(character_a: & Character, character_b: & Character) -> bool
168168 {
169169 println!("Check collision Enter");
170170
171171
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();
174174
175175 let char_width = 120.0;
176176
177177 //println!("checkCollision. A.state: {} B.state: {}", characterA.get_num_state(), characterB.get_num_state() );
178178
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();
181181
182182
183- let stateA:i32 = match raw_stateA {
183+ let state_a:i32 = match raw_state_a {
184184 character_state_machine::CharacterFSMState::StandMoveBack => 2,
185185 character_state_machine::CharacterFSMState::StandMoveFront => 1,
186186 character_state_machine::CharacterFSMState::StandIdle => 0,
@@ -189,7 +189,7 @@
189189 //None => -1
190190 };
191191
192- let stateB:i32 = match raw_stateB {
192+ let state_b:i32 = match raw_state_b {
193193 character_state_machine::CharacterFSMState::StandMoveBack => 2,
194194 character_state_machine::CharacterFSMState::StandMoveFront => 1,
195195 character_state_machine::CharacterFSMState::StandIdle => 0,
@@ -200,47 +200,47 @@
200200 };
201201
202202
203- println!("checkCollision. A.state: {} B.state: {}", stateA, stateB );
203+ println!("checkCollision. A.state: {} B.state: {}", state_a, state_b);
204204
205- if stateA == 1 && stateB == 0
205+ if state_a == 1 && state_b == 0
206206 {
207207 println!("Check collision A");
208208 //workaround until jumping is not implemented - so characters can't get past each other
209209 // return (pos_A.x + 1.0 + char_width - pos_B.x).abs() <= 1.0;
210210 }
211211
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() ;
214214 println!("Check collision B : {}", val);
215215
216216 //return val < 1.0;
217217 return val <= 1.0;
218218 }
219219
220- if stateA == 0 && stateB == 1
220+ if state_a == 0 && state_b == 1
221221 {
222222 println!("Check collision C");
223223
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;
225225 }
226226
227- if stateA == 0 && stateB == 2
227+ if state_a == 0 && state_b == 2
228228 {
229229 println!("Check collision D");
230230 //workaround until jumping is not implemented - so characters can't get past each other
231231 //return (pos_A.x + char_width - pos_B.x + 1.0).abs() <= 1.0;
232232 }
233233
234- if stateA == 1 && stateB == 2
234+ if state_a == 1 && state_b == 2
235235 {
236236 println!("Check collision E");
237237
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;
239239 }
240240
241- if stateA == 2 && stateB == 1
241+ if state_a == 2 && state_b == 1
242242 {
243- let val = (pos_A.x + char_width - pos_B.x ).abs() ;
243+ let val = (pos_a.x + char_width - pos_b.x ).abs() ;
244244 println!("Check collision F : {}", val);
245245
246246 //return val < 1.0;
Afficher sur ancien navigateur de dépôt.