Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dd5b074
Add files via upload
NicolasKritter Jan 7, 2017
2a873d1
Add files via upload
NicolasKritter Jan 7, 2017
a04dfaf
Add files via upload
NicolasKritter Jan 7, 2017
b9000a7
Add files via upload
NicolasKritter Jan 7, 2017
aae3492
Add files via upload
NicolasKritter Jan 10, 2017
f2e598e
Add files via upload
NicolasKritter Jan 10, 2017
486b328
Add files via upload
NicolasKritter Jan 11, 2017
91ddd8d
Add files via upload
NicolasKritter Jan 11, 2017
eb8d151
Add files via upload
NicolasKritter Jan 11, 2017
6f14aee
Add files via upload
NicolasKritter Jan 12, 2017
ae9e115
Add files via upload
NicolasKritter Jan 12, 2017
85416c2
Add files via upload
NicolasKritter Jan 13, 2017
67bca32
Add files via upload
NicolasKritter Jan 14, 2017
2ea939d
Add files via upload
NicolasKritter Jan 17, 2017
e894221
Add files via upload
NicolasKritter Jan 17, 2017
f62fbd4
Add files via upload
NicolasKritter Jan 17, 2017
62b9f97
Add files via upload
NicolasKritter Jan 18, 2017
30e8746
Add files via upload
NicolasKritter Jan 18, 2017
7827a21
Add files via upload
NicolasKritter Jan 18, 2017
b3d6771
Add files via upload
NicolasKritter Jan 18, 2017
6a2f4e7
Add files via upload
NicolasKritter Jan 20, 2017
932118d
Add files via upload
NicolasKritter Jan 20, 2017
b00c226
Add files via upload
NicolasKritter Jan 20, 2017
280601b
Add files via upload
NicolasKritter Jan 21, 2017
0746bd0
Add files via upload
NicolasKritter Jan 22, 2017
5208fde
Add files via upload
NicolasKritter Jan 22, 2017
5877557
Add files via upload
NicolasKritter Jan 22, 2017
a7ab065
Add files via upload
NicolasKritter Jan 22, 2017
f41ee30
Add files via upload
NicolasKritter Jan 22, 2017
f6a106e
Add files via upload
NicolasKritter Jan 22, 2017
8009255
Add files via upload
NicolasKritter Jan 22, 2017
55d89f4
Add files via upload
NicolasKritter Jan 26, 2017
c2485cc
Add files via upload
NicolasKritter Jan 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added GameData/Images/blued.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/bluel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/cookie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/oranged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/orangel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/pacd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/pacl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/pinkd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/pinkl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/redd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GameData/Images/redl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions src/Button.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import edu.princeton.cs.introcs.StdDraw;

public class Button extends Component{
public Button (int x0,int y0, int w, int h, String t){
super( x0, y0, w, h, t);


}

//changement visuel qui montre que la souris est sur le bouton
public void hooverDraw(){
StdDraw.setPenColor(StdDraw.BOOK_LIGHT_BLUE);
hoovered = true;
StdDraw.rectangle(x, y, width-6, height-4);
StdDraw.text(x, y, text);
StdDraw.show();
}

//TODO CALL LE HOOVER 1 FOIS?
//check si la souris est dessus
public boolean hoover(){
if(StdDraw.mouseX()>x-width && StdDraw.mouseX()<x+width && StdDraw.mouseY()>y-height && StdDraw.mouseY() <y+height){

hooverDraw();
return true;
}else if(hoovered){
dessiner();
}
return false;
}




}
32 changes: 32 additions & 0 deletions src/Component.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import edu.princeton.cs.introcs.StdDraw;

public class Component {
int x;
int y;
int width;
int height;
String text;
boolean hoovered;


public Component(int x0,int y0, int w, int h, String t){
x = x0;
y = y0;
width = w;
height = h;
text = t;


}
public void dessiner(){
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledRectangle(x, y, width, height);
StdDraw.setPenColor(StdDraw.BLUE);
StdDraw.rectangle(x, y, width, height);
StdDraw.text(x, y, text);
hoovered = false;
StdDraw.show();
}


}
47 changes: 47 additions & 0 deletions src/Cookie.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import edu.princeton.cs.introcs.StdDraw;

public class Cookie {
double x;
double y;
boolean bonus;
int taille;
Cookie suivant;
int tabx;
int taby;
public Cookie(int x0, int y0, int tx, int ty){
x = x0;
y = y0;
tabx = tx;
taby = ty;
taille = Main.taille*2;

}
public static Cookie addCookie(Cookie liste ,Cookie next) {

Cookie courant = liste;
if(courant==null){
liste = next;

}
else if (courant.suivant==null){

courant.suivant = next;
}
else{
addCookie(courant.suivant,next);
}


return liste;


}
//TODO a faire en réccursif ?

public void effacer(){
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledSquare(x,y,taille);
}


}
54 changes: 54 additions & 0 deletions src/EditText.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import java.awt.event.KeyEvent;

import edu.princeton.cs.introcs.StdDraw;

public class EditText extends Component{

String[] alphabet = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};

StringBuilder str = new StringBuilder();
public EditText(int x0, int y0){
super(x0,y0,250,50,"Joueur");

}
//TODO new font ?
public void updatetxt(){
//efface le contenu et on réaffiche
StdDraw.setPenColor();
StdDraw.filledRectangle(x, y, width-2, height-1);
StdDraw.setPenColor(StdDraw.YELLOW);
StdDraw.text(x, y, text);
}


public void writing(){
//si un touche a été tappée
if (StdDraw.hasNextKeyTyped()){
// on lit le numéro de la touche
int lettre = StdDraw.nextKeyTyped();


if(lettre == KeyEvent.VK_BACK_SPACE){
//supprime la dernière lettre si str n'est pas vide

if(str.length()>0){
str.deleteCharAt(str.length()-1);

}
}else if(lettre<123 && lettre>96 && str.length()<20){
//limite la taille du nom à 20 char
//On va chercher la lettre coresspondante
//CODE A: 97 Z:122
str.append(alphabet[lettre-97]);


}
text = str.toString();
updatetxt();
}

}



}
47 changes: 45 additions & 2 deletions src/Ghost.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
public class Ghost extends Perso{

public Ghost(int x0, int y0, int dir0, String nom) {
super(x0, y0, dir0, nom);
public Ghost(int x0, int y0, int dir0, String nom,String pic) {
super(x0, y0, dir0, nom,pic);

}
//0: bas 1: haut 2: gauche 3: droite
// fait "rebondir " un fantôme touche un qui mur
public void bounchehitwall(Map map){
int[] newdir = new int[3];
int oldir =this.dir;
switch(oldir){
case 0:
//Si le fantôme touche un mur en se déplacçant dans une direction
//On définie les nouveles directions possibles

newdir = new int[]{2,3,1};
break;
case 1:
newdir = new int[]{2,3,0};
break;
case 2:
newdir = new int[]{1,0,3};
break;
case 3:
newdir = new int[]{1,0,2};
break;

}
//Le fantôme choisis une nouvelle direction au hasard
//ordre: en arrière au dernier recours
int k = 0;
while( k<3 && this.checkhitwall(map, newdir[k])){
k = k+1;
}
this.dir = newdir[k];
//évite de prendre comme prochaine direction un retour en arrière
while(Math.abs(this.buffer-this.dir)==1){
this.buffer = newdir[Main.random.nextInt(3)];
}
/*
if(!this.checkhitwall(map, this.dir)){
this.buffer = newdir[Main.random.nextInt(2)];
}*/

//On met cette direction en prochaine direction pour éviter les aller-retour sur place


}
}
62 changes: 62 additions & 0 deletions src/Joueur.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

public class Joueur extends Perso{
int score;
int vie;
boolean bonus;
public Joueur(int x0, int y0, int dir0, String nom, String pic) {
super(x0, y0, dir0, nom,pic);
score = 0;
vie = 3;

}

public void hitwall(){
this.dir = -1;
}

//On regarde si le joueur est sur la même case qu'un cookie
public void checkhitcookie(Map map){
//On convertit la coordonnée du personnage en coordonnée du tableau de la carte
int[]coordcase = map.toCase(this.x, this.y);
int nx = coordcase [0];
int ny = coordcase[1];


if (map.coordcookie[nx][ny]!=null){

//identifie le cookie touché
Cookie supp = map.coordcookie[nx][ny];



//retire le cookie de la map
map.coordcookie[nx][ny]=null;

//décompte du nombre de cookie
map.nbcookie = map.nbcookie-1;

//augmente le score
this.score = this.score+2;

//rafraichit l'affichage du score
Main.refreshScore();

//efface le cookie de l'affichage
supp.effacer();

//efface le cookie dans la liste chaînée
map.deleteCookie(supp);

//si il ne reste plus de cookie, on termine la partie
if(map.nbcookie<1){
Main.fin();
}



}
}



}
Loading