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
2ce59232
Commit
2ce59232
authored
4 years ago
by
Villard PierreFrederic
Browse files
Options
Downloads
Patches
Plain Diff
TestMario working
parent
185bf7d8
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/physique/Monde.java
+1
-12
1 addition, 12 deletions
src/physique/Monde.java
src/physique/MoteurPhysique.java
+25
-13
25 additions, 13 deletions
src/physique/MoteurPhysique.java
test/testMario.java
+5
-1
5 additions, 1 deletion
test/testMario.java
with
31 additions
and
26 deletions
src/physique/Monde.java
+
1
−
12
View file @
2ce59232
...
@@ -67,18 +67,7 @@ public class Monde {
...
@@ -67,18 +67,7 @@ public class Monde {
//gere la vision subjective
//gere la vision subjective
Repere
.
h
=
balle
;
Repere
.
h
=
balle
;
// //ajouter monstre
// monstres.add(new ObjetMonstre());
// //penser a le lier au monde
// monstres.get(0).m=this;
//
// //ajouter monstre
// monstres.add(new ObjetMonstre());
// //penser � le lier au monde
// monstres.get(1).m=this;
// monstres.get(1).vx=-0.1;
// monstres.get(1).px=300;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/physique/MoteurPhysique.java
+
25
−
13
View file @
2ce59232
...
@@ -31,29 +31,30 @@ public class MoteurPhysique {
...
@@ -31,29 +31,30 @@ public class MoteurPhysique {
*/
*/
public
Monde
monde
;
public
Monde
monde
;
// construit un moteur par defaut
public
boolean
gravity
=
true
;
/**
/**
*
*
Construit un moteur par defaut
* @throws IOException
* @throws IOException
*/
*/
public
MoteurPhysique
()
throws
IOException
{
public
MoteurPhysique
()
throws
IOException
{
monde
=
new
Monde
();
monde
=
new
Monde
();
}
}
// met
�
jour le monde
// met
a
jour le monde
/**
/**
*
*
*/
*/
public
void
update
()
{
public
void
update
()
{
// mise
�
jour des objets
// mise
a
jour des objets
for
(
Objet
o
:
monde
.
objets
)
{
for
(
Objet
o
:
monde
.
objets
)
{
o
.
update
();
o
.
update
();
o
.
collision
=
false
;
o
.
collision
=
false
;
}
}
// mise
�
jour des monstres
// mise
a
jour des monstres
for
(
ObjetMonstre
monstre
:
monde
.
monstres
)
{
for
(
ObjetMonstre
monstre
:
monde
.
monstres
)
{
monstre
.
evolue
();
monstre
.
evolue
();
}
}
...
@@ -96,17 +97,28 @@ public class MoteurPhysique {
...
@@ -96,17 +97,28 @@ public class MoteurPhysique {
if
(
monde
.
balle
.
vx
<
0
)
monde
.
balle
.
ax
=
+
0.1
;
if
(
monde
.
balle
.
vx
<
0
)
monde
.
balle
.
ax
=
+
0.1
;
}
}
//gestion des sauts
//gestion des sauts
if
((
monde
.
c
.
haut
)&&(!
monde
.
c
.
enAir
))
if
(
gravity
)
{
{
monde
.
balle
.
sprites
.
changeEtape
(
"saut"
);
if
((
monde
.
c
.
haut
)&&(!
monde
.
c
.
enAir
))
monde
.
balle
.
vy
=
3
;
{
monde
.
balle
.
ay
=-
0.04
;
monde
.
balle
.
sprites
.
changeEtape
(
"saut"
);
monde
.
c
.
enAir
=
true
;
monde
.
balle
.
vy
=
3
;
}
monde
.
balle
.
ay
=-
0.04
;
monde
.
c
.
enAir
=
true
;
}
}
else
{
if
(
monde
.
c
.
haut
)
{
monde
.
balle
.
ay
=
0.1
;
}
}
monde
.
balle
.
collision
=
false
;
monde
.
balle
.
collision
=
false
;
// mise
�
jour de la balle
// mise
a
jour de la balle
monde
.
balle
.
update
();
monde
.
balle
.
update
();
// test de collision pour chaque mur
// test de collision pour chaque mur
...
...
This diff is collapsed.
Click to expand it.
test/testMario.java
+
5
−
1
View file @
2ce59232
...
@@ -69,11 +69,15 @@ public class testMario {
...
@@ -69,11 +69,15 @@ public class testMario {
/////////////////////
/////////////////////
monMonde
.
addMonstre
(
0.5
,
0
,
200
,
0
);
monMonde
.
addMonstre
(
0.5
,
0
,
200
,
0
);
monMonde
.
addMonstre
(-
0.1
,
0
,
300
,
0
);
monMonde
.
addMonstre
(-
0.1
,
0
,
300
,
0
);
monMonde
.
monstres
.
get
(
0
).
height
=
70
;
//////////////////////
// Le Hero
/////////////////////
//on creer le moteur physique
//on creer le moteur physique
moteurPhys
=
new
MoteurPhysique
();
moteurPhys
=
new
MoteurPhysique
();
moteurPhys
.
gravity
=
false
;
//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
...
...
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