diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..a5eed8b458451a4015757ea1ffb299b887782a75 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.dependency.packagePresentation": "hierarchical" +} \ No newline at end of file diff --git a/src/controle/Controle.java b/src/controle/Controle.java index 161a35511ba392674edebd9fdb53a894a4a23ba7..bd49a08dc0a287e0298c19a045981a08481678f8 100644 --- a/src/controle/Controle.java +++ b/src/controle/Controle.java @@ -37,7 +37,12 @@ public class Controle { * */ static public boolean haut; - + + /** + * + */ + static public boolean bas; + /** * */ diff --git a/src/controle/ControleurClavier.java b/src/controle/ControleurClavier.java index e608e864c73e1370d0e7675b1eaafc8aa3fd3985..efc47c457d1c44a35e938fd61cfcf9785df266db 100644 --- a/src/controle/ControleurClavier.java +++ b/src/controle/ControleurClavier.java @@ -77,7 +77,11 @@ public class ControleurClavier implements KeyListener{ { c.haut=true; } - + //touche down + if (e.getKeyCode()==KeyEvent.VK_DOWN) + { + c.bas=true; + } //touche up if (e.getKeyCode()==KeyEvent.VK_Q) { @@ -104,6 +108,11 @@ public class ControleurClavier implements KeyListener{ { c.haut=false; } + //touche down + if (e.getKeyCode()==KeyEvent.VK_DOWN) + { + c.bas=false; + } if (affiche) afficheur.dessin(); } diff --git a/src/physique/MoteurPhysique.java b/src/physique/MoteurPhysique.java index 2cf4c4b60d6af4c05943b1a7551df10195b07d2e..0b46d9d9aadad31a5c8cb312005839ea3884b634 100644 --- a/src/physique/MoteurPhysique.java +++ b/src/physique/MoteurPhysique.java @@ -111,10 +111,16 @@ public class MoteurPhysique { } else { + monde.balle.ay = 0; + monde.balle.vy = 0; if (monde.c.haut) { - monde.balle.ay = 0.1; + monde.balle.vy = 1; } + if (monde.c.bas) + { + monde.balle.vy = -1; + } } monde.balle.collision=false; @@ -128,7 +134,6 @@ public class MoteurPhysique { //m.balle.collision = true; //obj.collision=true; - //si collision vient de la gauche ou droite if (Collision.collisionGauche(monde.balle,obj) || (Collision.collisionDroite(monde.balle,obj))) @@ -154,12 +159,13 @@ public class MoteurPhysique { } } - + //si collision vient du Bas if (Collision.collisionBas(monde.balle,obj)) { + monde.balle.py = monde.balle.py - monde.balle.vy; - monde.balle.vy=-monde.balle.vy; + monde.balle.vy=-monde.balle.vy;; } } }