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

Add a second hero in the list

parent 018b7cd7
Branches
No related tags found
No related merge requests found
...@@ -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;
... ...
......
...@@ -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
... ...
......
...@@ -44,13 +44,15 @@ public class testFighter { ...@@ -44,13 +44,15 @@ public class testFighter {
///////////////////// /////////////////////
//sol //sol
monMonde.addMur(0,-20,600,20); monMonde.addMur(-200,-20,1000,20);
////////////////////// //////////////////////
// Le Hero // Le Hero
///////////////////// /////////////////////
monMonde.addHero(0,0,500,20);
//on creer le moteur physique //on creer le moteur physique
... ...
......
...@@ -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,22); monMonde.addMur(0,-20,600,20);
//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=false; 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
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment