Skip to content
Snippets Groups Projects
Commit 784625c0 authored by Villard PierreFrederic's avatar Villard PierreFrederic
Browse files

Add the possibility to change the gravity value

parent 4f4af94e
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,8 @@ public class MoteurPhysique { ...@@ -33,6 +33,8 @@ public class MoteurPhysique {
public boolean gravity=true; public boolean gravity=true;
public float gravityValue=-0.04f;
/** /**
* Construit un moteur par defaut * Construit un moteur par defaut
...@@ -105,7 +107,7 @@ public class MoteurPhysique { ...@@ -105,7 +107,7 @@ public class MoteurPhysique {
{ {
monde.balle.sprites.changeEtape("saut"); monde.balle.sprites.changeEtape("saut");
monde.balle.vy=3; monde.balle.vy=3;
monde.balle.ay=-0.04; monde.balle.ay=gravityValue;
monde.c.enAir=true; monde.c.enAir=true;
} }
} }
......
...@@ -81,7 +81,6 @@ public class testMario { ...@@ -81,7 +81,6 @@ public class testMario {
//on creer le moteur physique //on creer le moteur physique
moteurPhys=new MoteurPhysique(); moteurPhys=new MoteurPhysique();
moteurPhys.gravity=true;
//On ajoute le monde au moteur //On ajoute le monde au moteur
moteurPhys.monde=monMonde; moteurPhys.monde=monMonde;
//on creer l'afficheur du monde //on creer l'afficheur du monde
...@@ -95,7 +94,13 @@ public class testMario { ...@@ -95,7 +94,13 @@ public class testMario {
// Ajout du jeu à la boucle // Ajout du jeu à la boucle
maBoucle.jeuPhysique.moteurPhys=moteurPhys; maBoucle.jeuPhysique.moteurPhys=moteurPhys;
// Test to change the image
//monMonde.balle.sprites.assignNewImage("hero2.png"); //monMonde.balle.sprites.assignNewImage("hero2.png");
// Test to change the gravity value
//moteurPhys.gravityValue=-0.4f;
// Test to remove the gravity
//moteurPhys.gravity=true;
maBoucle.lanceBouclePrincipale(); maBoucle.lanceBouclePrincipale();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment