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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Villard PierreFrederic
MoteurDeJeu
Commits
1da26c1c
Commit
1da26c1c
authored
Sep 13, 2021
by
Villard PierreFrederic
Browse files
Options
Downloads
Patches
Plain Diff
Add a second hero in the list
parent
018b7cd7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/physique/Monde.java
+2
-2
2 additions, 2 deletions
src/physique/Monde.java
src/physique/ObjetHeros.java
+18
-1
18 additions, 1 deletion
src/physique/ObjetHeros.java
test/testFighter.java
+3
-1
3 additions, 1 deletion
test/testFighter.java
test/testMario.java
+2
-2
2 additions, 2 deletions
test/testMario.java
with
25 additions
and
6 deletions
src/physique/Monde.java
+
2
−
2
View file @
1da26c1c
...
@@ -118,7 +118,7 @@ public class Monde {
...
@@ -118,7 +118,7 @@ public class Monde {
* @param py
* @param py
* @throws java.io.IOException */
* @throws java.io.IOException */
public
void
addHero
(
double
vx
,
double
vy
,
int
px
,
int
py
)
throws
IOException
{
public
void
addHero
(
double
vx
,
double
vy
,
int
px
,
int
py
)
throws
IOException
{
heros
.
add
(
new
ObjetHeros
());
heros
.
add
(
new
ObjetHeros
(
px
,
py
));
// propriétés du monstre
// propriétés du monstre
heros
.
get
(
nbHeros
).
vx
=
vx
;
heros
.
get
(
nbHeros
).
vx
=
vx
;
heros
.
get
(
nbHeros
).
vy
=
vy
;
heros
.
get
(
nbHeros
).
vy
=
vy
;
...
...
...
...
This diff is collapsed.
Click to expand it.
src/physique/ObjetHeros.java
+
18
−
1
View file @
1da26c1c
...
@@ -57,7 +57,24 @@ public class ObjetHeros extends Objet{
...
@@ -57,7 +57,24 @@ public class ObjetHeros extends Objet{
ax
=
0
;
ax
=
0
;
ay
=-
0.04
;
ay
=-
0.04
;
}
}
/**
*
* @throws IOException
*/
public
ObjetHeros
(
int
x
,
int
y
)
throws
IOException
{
sprites
=
new
SpritesHeros
(
this
);
height
=
10
;
width
=
10
;
height
=
sprites
.
sprites
.
get
(
"fixe"
).
ty
;
width
=
sprites
.
sprites
.
get
(
"fixe"
).
tx
;
px
=
x
;
py
=
y
;
vx
=
1
;
vy
=
3
;
ax
=
0
;
ay
=-
0.04
;
}
/**
/**
*
*
* @param g
* @param g
...
...
...
...
This diff is collapsed.
Click to expand it.
test/testFighter.java
+
3
−
1
View file @
1da26c1c
...
@@ -44,13 +44,15 @@ public class testFighter {
...
@@ -44,13 +44,15 @@ public class testFighter {
/////////////////////
/////////////////////
//sol
//sol
monMonde
.
addMur
(
0
,-
20
,
6
00
,
20
);
monMonde
.
addMur
(
-
20
0
,-
20
,
10
00
,
20
);
//////////////////////
//////////////////////
// Le Hero
// Le Hero
/////////////////////
/////////////////////
monMonde
.
addHero
(
0
,
0
,
500
,
20
);
//on creer le moteur physique
//on creer le moteur physique
...
...
...
...
This diff is collapsed.
Click to expand it.
test/testMario.java
+
2
−
2
View file @
1da26c1c
...
@@ -49,7 +49,7 @@ public class testMario {
...
@@ -49,7 +49,7 @@ public class testMario {
monMonde
.
addMur
(
100
,
20
,
50
,
50
);
monMonde
.
addMur
(
100
,
20
,
50
,
50
);
//sol
//sol
monMonde
.
addMur
(
0
,-
20
,
600
,
2
2
);
monMonde
.
addMur
(
0
,-
20
,
600
,
2
0
);
//mur vertical centre
//mur vertical centre
MurCool
monMur
=
new
MurCool
(
250
,
65
,
50
,
200
);
MurCool
monMur
=
new
MurCool
(
250
,
65
,
50
,
200
);
...
@@ -80,7 +80,7 @@ public class testMario {
...
@@ -80,7 +80,7 @@ public class testMario {
//on creer le moteur physique
//on creer le moteur physique
moteurPhys
=
new
MoteurPhysique
();
moteurPhys
=
new
MoteurPhysique
();
moteurPhys
.
gravity
=
fals
e
;
moteurPhys
.
gravity
=
tru
e
;
//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
sign in
to comment