Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MoteurDeJeu
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Villard PierreFrederic
MoteurDeJeu
Commits
784625c0
Commit
784625c0
authored
3 years ago
by
Villard PierreFrederic
Browse files
Options
Downloads
Patches
Plain Diff
Add the possibility to change the gravity value
parent
4f4af94e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/physique/MoteurPhysique.java
+3
-1
3 additions, 1 deletion
src/physique/MoteurPhysique.java
test/testMario.java
+6
-1
6 additions, 1 deletion
test/testMario.java
with
9 additions
and
2 deletions
src/physique/MoteurPhysique.java
+
3
−
1
View file @
784625c0
...
@@ -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
;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
test/testMario.java
+
6
−
1
View file @
784625c0
...
@@ -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
();
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment