Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config Azure Cloud #21

Open
wants to merge 73 commits into
base: deploiement
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
3ea6c59
Merge pull request #18 from dalek63/deploiement
zackbmz Dec 31, 2023
bd7f7a4
Add or update the Azure App Service build and deployment workflow config
zackbmz Dec 31, 2023
2bee6a6
Merge pull request #19 from zackbmz/main
zackbmz Dec 31, 2023
c6d5cf9
Merge pull request #22 from dalek63/deploiement
zackbmz Dec 31, 2023
34b7b78
debut grille debuggage
dalek63 Oct 20, 2023
1226b74
premiere version deplacement pacman
dalek63 Oct 24, 2023
7a3e270
instanciation d'un objet Jeu dans main et petits reglages
dalek63 Oct 25, 2023
6401798
classe main nettoyée
dalek63 Oct 25, 2023
fd03423
arret devant mur + ajout de terrain
dalek63 Dec 26, 2023
a45b0b4
direction aleatoire
dalek63 Dec 26, 2023
2837af6
commentaires
dalek63 Dec 26, 2023
f173c0c
Fix grille
zackbmz Dec 26, 2023
5707871
reglage probleme out of index
dalek63 Dec 26, 2023
02a528f
Reaction et déplacement face aux Bonus (Boule/SuperBoule et les fruit…
zackbmz Dec 29, 2023
93742fb
fix bug reaction kiwi
zackbmz Dec 29, 2023
0f94723
Fix bug grille + SDK Version
zackbmz Jan 4, 2024
cdca743
Merge pull request #20 from dalek63/bonus
zackbmz Jan 4, 2024
667aeb5
Test web socekt
zackbmz Jan 5, 2024
20cce9c
test socket
zackbmz Jan 5, 2024
2b7770e
test api rest
zackbmz Jan 5, 2024
2159983
test api rest V2
zackbmz Jan 5, 2024
cbb76be
test api rest V3
zackbmz Jan 5, 2024
3ea6a99
test api rest v3
zackbmz Jan 5, 2024
c924377
Fix depalcement fantomes
zackbmz Jan 5, 2024
32b97b0
Mise en place niveaux
zackbmz Jan 6, 2024
41952ba
fix bug vies
zackbmz Jan 6, 2024
3012487
Refacto: nouvelle logique jeu et connexion API
Svvmy Jan 7, 2024
b494ce5
Update README.md
BelhaddadSarah Jan 7, 2024
3800b26
modification du score quand on mangerBoule et SuperBoule
Svvmy Jan 7, 2024
36f30e2
Update README.md
BelhaddadSarah Jan 7, 2024
bc5c30c
Merge branch 'main' of https://github.com/dalek63/pacman
Svvmy Jan 7, 2024
2b5b5e6
Update README.md
BelhaddadSarah Jan 7, 2024
02e8586
Update README.md
BelhaddadSarah Jan 7, 2024
88bef50
Update README.md
BelhaddadSarah Jan 7, 2024
76108f4
Update README.md
BelhaddadSarah Jan 7, 2024
018b474
Update README.md
BelhaddadSarah Jan 7, 2024
f1afb81
Update README.md
BelhaddadSarah Jan 7, 2024
428248b
Update README.md
BelhaddadSarah Jan 7, 2024
bb19bd2
Fix bug score
zackbmz Jan 7, 2024
a884bee
Update README.md
BelhaddadSarah Jan 7, 2024
03441d4
Update README.md
BelhaddadSarah Jan 7, 2024
ff539a8
Update README.md
BelhaddadSarah Jan 7, 2024
a9d5023
Impementation score fruit
zackbmz Jan 7, 2024
3eed2e3
Merge branch 'main' of https://github.com/dalek63/pacman
zackbmz Jan 7, 2024
5060bbf
test déploiement
zackbmz Jan 7, 2024
007a3ae
Add or update the Azure App Service build and deployment workflow config
dalek63 Jan 7, 2024
4a2e5ee
Delete .github/workflows/main_pacmanaos.yml
dalek63 Jan 7, 2024
131dea2
Update README.md
BelhaddadSarah Jan 7, 2024
2626229
Fin de jeu
zackbmz Jan 7, 2024
ced2cd6
Merge branch 'main' of https://github.com/dalek63/pacman
zackbmz Jan 7, 2024
dd83520
Nettoyage et optimisation du code
zackbmz Jan 7, 2024
3f0f075
fix bug api upgrade-grid
Svvmy Jan 7, 2024
f7238fb
Resolve conflict
Svvmy Jan 7, 2024
cb0879f
add api endpoint to loadMap and correc
Svvmy Jan 8, 2024
933aff1
draft: mode sans mur
Svvmy Jan 8, 2024
cbc3f75
fix bug fantomes v1
zackbmz Jan 8, 2024
285e9dc
fix bug v2
zackbmz Jan 8, 2024
94594bb
Changement de niveau en cours de construction
zackbmz Jan 8, 2024
96b51a7
Ajout gestion et gameOver et correctif gestion de niveau
Svvmy Jan 11, 2024
b8cf437
Fix bug: duplication de fantome
Svvmy Jan 11, 2024
4587d40
correction code
Svvmy Jan 11, 2024
0271dde
fix bug limite de grille et la méthode toutesLesBoulesMangees
Svvmy Jan 12, 2024
eea2cf4
Fix bug deplacement limite de grille et correctifs
Svvmy Jan 13, 2024
3c287da
Ajustement et correctif + log
Svvmy Jan 15, 2024
896d809
CORS config : add allowed origin front netlify
Svvmy Jan 16, 2024
7692213
fix Front Cors Config
Svvmy Jan 16, 2024
0db0397
fix deploy Cross Origin
Svvmy Jan 16, 2024
86caff6
Correctif Réinitialisation de grille et changement de map
Svvmy Jan 16, 2024
4ee1bcc
Fix réinitialisation grille
Svvmy Jan 16, 2024
97b7540
Séparation UpdateGrid fantome et pacman
Svvmy Jan 16, 2024
2f2d2f4
Try to fix deploy 404
Svvmy Jan 16, 2024
c67cf3b
Add mode classic and multiLevel
Svvmy Jan 16, 2024
55ce818
add level map
Svvmy Jan 16, 2024
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
53 changes: 53 additions & 0 deletions .github/workflows/main_pacmanwebapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: Build and deploy JAR app to Azure Web App - pacmanwebapp

on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up Java version
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Build with Maven
run: mvn clean install

- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: java-app
path: '${{ github.workspace }}/target/*.jar'

deploy:
runs-on: windows-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: java-app

- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'pacmanwebapp'
slot-name: 'Production'
package: '*.jar'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_5A7719FB4BD34FEC986840EF0C861E96 }}
Binary file modified README.md
Binary file not shown.
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-messaging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
Expand Down
15 changes: 14 additions & 1 deletion src/main/java/Classes/Boule.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package Classes;

import java.util.List;

public class Boule {
private Point position;
private boolean superBoule ;

public Boule(Point position, boolean superBoule ) {

public Boule(Point position) {
this.position = position;
this.superBoule = superBoule;
}

public Point getPosition() {
Expand All @@ -14,4 +19,12 @@ public Point getPosition() {
public void setPosition(Point position) {
this.position = position;
}


public int getScore() {
int points = 25 ;
return points;
}


}
36 changes: 36 additions & 0 deletions src/main/java/Classes/DirectionWrapper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package Classes;

public class DirectionWrapper{
private String direction;


public DirectionWrapper(String direction){
this.direction = direction;
}
public int getDirection() {
return convertStringToInt(direction);
}

public void setDirection(String direction) {
this.direction = direction;
}

// Convertit la direction recu en JSON en int
public int convertStringToInt(String direction){
switch (direction) {
case "0":
return 0;
case "1":
return 1;
case "2":
return 2;
case "3":
return 3;
case "-1":
return -1;
default:
throw new IllegalArgumentException("La direction doit être l'une des valeurs suivantes : -1, 0, 1, 2, 3");
}
}

}
164 changes: 162 additions & 2 deletions src/main/java/Classes/Fantome.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,168 @@
package Classes;

public abstract class Fantome extends Personnage {
import java.util.Random;

public class Fantome extends Personnage {
private ModeFantome mode;

private Game game;

private char caseEcrasee;


public Fantome(Point position, Game game) {
super(position);
this.game = game;
}

public Fantome(Point position, Direction direction, ModeFantome mode) {
super(position, direction);
this.mode = mode;
}

public void deplacer(char[][] terrain) {
Random random = new Random();
int direction;

Point position = getPosition();
int positionX = position.getPositionX();
int positionY = position.getPositionY();
int directionSave = 5;
int anciennePositionX = positionX;
int anciennePositionY = positionY;
// char ancienContenu = this.game.getTerrain()[anciennePositionX][anciennePositionY];

System.out.println("Postion Fantome "+ position.getPositionX() +" "+position.getPositionY());

// Choisir une direction aléatoire (0 pour haut, 1 pour droite, 2 pour bas, 3 pour gauche)
do {

direction = random.nextInt(4);
directionSave = direction;
System.out.println("Direction aléatoirement choisi: "+direction);
} while (!peutSeDeplacer(terrain, direction, positionX, positionY));

// direction = random.nextInt(4);
// System.out.println("Direction aléatoirement choisi: "+direction);
// if(!peutSeDeplacer(terrain, direction, positionX, positionY)){

// if (this.game.modeSansMurIsActive()) {
// direction = (random.nextBoolean()) ? 0 : 2; // Choisir aléatoirement entre haut (0) et bas (2)
// } else {
// // Choisir une direction aléatoire (0 pour haut, 1 pour droite, 2 pour bas, 3 pour gauche)
// do {
// direction = random.nextInt(4);
// System.out.println("doWHile et direction: " + direction);
// } while (!peutSeDeplacer(terrain, direction, positionX, positionY));
// }

// Déplacer le fantôme dans la direction choisie
switch (direction) {
case 0:
// Déplacer vers le haut
System.out.println("Fantome: Déplacement autorisé Vers le haut");
position.setPositionX(position.getPositionX() - 1);
break;
case 1:
// Déplacer vers la droite
System.out.println("Fantome: Déplacement autorisé vers la droite");
position.setPositionY(position.getPositionY() + 1);
break;
case 2:
// Déplacer vers le bas
System.out.println("Fantome: Déplacement autorisé vers le bas");
position.setPositionX(position.getPositionX() + 1);
break;
case 3:
// Déplacer vers la gauche
System.out.println("Fantome: Déplacement autorisé vers la gauche");
position.setPositionY(position.getPositionY() - 1);
break;
}


/*
char nouveauContenu = terrain[position.getPositionX()][position.getPositionY()];
if (estUnBonus(nouveauContenu)) {
caseEcrasee = nouveauContenu;
} else {
caseEcrasee = '.'; // Si la nouvelle position n'est pas un bonus, réinitialisez caseEcrasee
}
*/
terrain[anciennePositionX][anciennePositionY] = '.';
terrain[position.getPositionX()][position.getPositionY()] = 'F'; // Nouvelle position avec le fantôme
// this.game.getTerrain()[anciennePositionX][anciennePositionY] = ancienContenu; // Restaurer le bonus à l'ancienne position du fantôme

System.out.println("Postion Fantome après maj "+ position.getPositionX() +" "+ position.getPositionY());

}

private boolean peutSeDeplacer(char[][] terrain, int direction, int positionX, int positionY) {
// Nouvelles coordonnées après le déplacement
int newX = positionX;
int newY = positionY;

switch (direction) {
case 0:
newX--; // Déplacement vers le haut
System.out.println("Fantome Vers le haut");
break;
case 1:
newY++; // Déplacement vers la droite
System.out.println("Fantome Vers le droite");
break;
case 2:
newX++; // Déplacement vers le bas
System.out.println("Fantome Vers le bas");
break;
case 3:
newY--; // Déplacement vers la gauche
System.out.println("Fantome Vers le gauche");
break;
default:
return false; // Direction non valide
}

// // Vérifier les limites de la grille
// if (newX < 0 || newX >= this.game.getTerrain().length || newY < 0 || newY >= this.game.getTerrain()[0].length) {
// System.out.println("Fantome a atteint la limite de grille " + direction);
// System.out.println("Valeur de NewX = "+newX);
// System.out.println("TabX valeur = "+terrain[0].length);
// System.out.println("Valeur de NewY = "+newY);
// System.out.println("TabY valeur = "+terrain.length);
//
// return false; // En dehors de la grille
// }

// Vérifier s'il y a un mur à la nouvelle position
if (terrain[newX][newY] == 'M') {
System.out.println("Collision Fantome avec un MUR");
return false; // Mur présent
}

if (terrain[newX][newY] == 'P') {
// Collision avec un fantôme, perdre une vie
System.out.println("Collision avec un Pacman");
this.game.getPacMan().perdreVies();
return true;
}
/*
if(estUnBonus(this.game.getTerrain()[newX][newY])){
caseEcrasee = this.game.getTerrain()[newX][newY];
System.out.println("Case écraser "+ caseEcrasee );
}
*/

return true; // Déplacement autorisé
}

/*

private boolean estUnBonus(char contenu) {
return contenu == 'o' || contenu == 'O' || contenu == 'B' || contenu == 'C' || contenu == 'K';
}
*/

public ModeFantome getMode() {
return mode;
}
Expand All @@ -32,7 +187,12 @@ public void manger() {
// Comportement de devenir mangé par Pac-Man
}

@Override

public void deplacer() {
}

@Override
public void mourir() {

}
}
18 changes: 13 additions & 5 deletions src/main/java/Classes/Fruit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package Classes;

import java.util.List;

public class Fruit {
private TypeFruit type;
private Point position;
Expand All @@ -24,22 +26,28 @@ public Point getPosition() {
public void setPosition(Point position) {
this.position = position;
}
// Méthode pour obtenir l'objet Fruit à une position spécifique dans la liste de fruits

public int getPointsFruit() {

public int getScore() {
// Implémentez la logique pour obtenir le nombre de points associés à ce fruit
// Par exemple, en utilisant une correspondance entre le type de fruit et les points
int points = 0;
switch (type) {
case CERISE:
points = 100; // Exemple de points pour une cerise
break;
case ORANGE:
case BANANE:
points = 200; // Exemple de points pour une orange
break;
// Ajoutez d'autres cas pour les différents types de fruits

case KIWI :
points = 300;

break;
default:
points = 0; // Par défaut, aucun point
}
return points;
}


}
Loading
Loading