• R/O
  • SSH

silny-kombat: Commit

Mercurial repo for silny-kombat project


Commit MetaInfo

Révision0ae49b6099db318afe8567a5fe06d1e25460de48 (tree)
l'heure2023-01-26 03:31:20
AuteurSecT <grzegorzstarowicz@gmai...>
CommiterSecT

Message de Log

Check collision for punching

Change Summary

Modification

diff -r 7f2576f49091 -r 0ae49b6099db src/controller.rs
--- a/src/controller.rs Wed Jan 25 19:22:16 2023 +0100
+++ b/src/controller.rs Wed Jan 25 19:31:20 2023 +0100
@@ -204,14 +204,20 @@
204204
205205 println!("checkCollision. A.state: {} B.state: {}", state_a, state_b);
206206
207- if state_a == state_enums::States::MovingRight as i32 && ( state_b == state_enums::States::Idle as i32 || state_b == state_enums::States::Crouching as i32)
207+ if state_a == state_enums::States::MovingRight as i32 &&
208+ ( state_b == state_enums::States::Idle as i32
209+ || state_b == state_enums::States::Crouching as i32
210+ || state_b == state_enums::States::Punching as i32)
208211 {
209212 println!("Check collision A");
210213 //workaround until jumping is not implemented - so characters can't get past each other
211214 // return (pos_A.x + 1.0 + char_width - pos_B.x).abs() <= 1.0;
212215 }
213216
214- if state_a == state_enums::States::MovingLeft as i32 && (state_b == state_enums::States::Idle as i32 || state_b == state_enums::States::Crouching as i32 )
217+ if state_a == state_enums::States::MovingLeft as i32 &&
218+ (state_b == state_enums::States::Idle as i32
219+ || state_b == state_enums::States::Crouching as i32
220+ || state_b == state_enums::States::Punching as i32)
215221 { let val = (pos_a.x - 1.0 + char_width - pos_b.x).abs() ;
216222 println!("Check collision B : {}", val);
217223
@@ -219,14 +225,18 @@
219225 return val <= 1.0;
220226 }
221227
222- if (state_a == state_enums::States::Idle as i32 || state_a == state_enums::States::Crouching as i32 ) && state_b == state_enums::States::MovingRight as i32
228+ if (state_a == state_enums::States::Idle as i32 || state_a == state_enums::States::Crouching as i32 ||
229+ state_a == state_enums::States::Punching as i32)
230+ && state_b == state_enums::States::MovingRight as i32
223231 {
224232 println!("Check collision C");
225233
226234 return (pos_a.x + char_width - pos_b.x - 1.0).abs() <= 1.0;
227235 }
228236
229- if ( state_a == state_enums::States::Idle as i32 || state_a == state_enums::States::Crouching as i32 ) && state_b == state_enums::States::MovingLeft as i32
237+ if ( state_a == state_enums::States::Idle as i32 || state_a == state_enums::States::Crouching as i32 ||
238+ state_a == state_enums::States::Punching as i32)
239+ && state_b == state_enums::States::MovingLeft as i32
230240 {
231241 println!("Check collision D");
232242 //workaround until jumping is not implemented - so characters can't get past each other
Afficher sur ancien navigateur de dépôt.