diff --git a/lab5/README.md b/lab5/README.md index 0d4e85804faf9b6228d13235131881d6a0318126..fe199e9652bc711e47f273fdb900709d9bca677e 100644 --- a/lab5/README.md +++ b/lab5/README.md @@ -1,26 +1,35 @@ Cedric Dos Reis + # lab5 - IHM -READ `./src/README.md` for installation guide +Read `./src/README.md` for installation guide + ## Features -User move the caracter within a path using arrow key. - -Enemies spawn. - -Caracter eats food on collision. - -Caracter dies if he colides with an enemy. -Enemies move randomly in available direction within a path. - -Loading map structure from an image file. Read `./src/maps/README.md` for more informations +* User move the caracter within a path using arrow key. + +* Enemies spawn. + +* Caracter eats food on collision. + +* Caracter dies if he colides with an enemy. + +* Enemies move randomly in available direction within a path. + +* Loading map structure from an image file. Read `./src/maps/README.md` for more informations + +* Zoom in and out using `i` and `o` keys. ### Flask server with 2 routes -`/get/map/<id>` : get an 1D array of string defining the map strcuture. `<id>` : file name of the map (without extension). +Read `./src/README.md` for installation guide + +#### Routes +`/get/map/<id>` : get an 1D array of string defining the map strcuture. `<id>` : file name of the map (without extension). + `/get/maps/` : get a 2D array of string which contains the list of maps in `./src/maps/` (This route is not used). + +## Features to be added -## Features to ba added -Let the user choose which map he wants to play in. - +Let the user choose which map he wants to play in. \ No newline at end of file diff --git a/lab5/src/README.md b/lab5/src/README.md index f1385a2fc479136f05693c2dfa28c637086b856b..929ba25c0fb483b2b300726230ca6494f036d505 100644 --- a/lab5/src/README.md +++ b/lab5/src/README.md @@ -1,117 +1,89 @@ -# Festival - restfull API module -## Installation - -### Setting up a virtual environment for the REST API - -1. Install `virtualenv` package and create a new environment in the `src` folder project +# Pac Man - restfull API module - On Linux and macOS : - - ``` - python3 -m virtualenv env - ``` - - On Windows : +## Installation - ``` - python -m virtualenv env - ``` +### Setting up a virtual environment for the REST API with python -2. Activate the virtual environment with : +1. Install `virtualenv` package and create a new environment in the `./src` folder project - On Linux and macOS : + - ``` - source env/bin/activate - ``` + On Linux and macOS : - On Windows : + - ``` - .\env\Scripts\activate - ``` + ``` + python3 -m virtualenv env + ``` -3. Then install all packages dependencies in `requirements.txt` : + - ``` - pip install -r requirements.txt - ``` - -4. Define environment variable - - On Linux and macOS : - - ``` - export FLASK_ENV=development - export FLASK_APP=app.py - ``` - - On Windows : - - ``` - set FLASK_ENV=development - set FLASK_APP=app.py - ``` - -## Starting the web server (REST API) + On Windows : - python -m flask run + -## Starting the web client + ``` + python -m virtualenv env + ``` - http://localhost:5000/ + -## Documentation +2. Activate the virtual environment with : -### Installation + -1. Install nodejs on your system + On Linux and macOS : - On Linux and macOS : + - ``` - sudo apt-get install curl - curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - - sudo apt-get install nodejs - sudo apt-get install npm - ``` + ``` + source env/bin/activate + ``` - On Windows : + On Windows : + + ``` + .\env\Scripts\activate + ``` + +3. Then install all packages dependencies in `requirements.txt` : - Dowload nodejs installer and install it with npm package manager, then reboot your computer - https://nodejs.org/en/download/ + -2. Then install APIDOC tool + ``` + pip install -r requirements.txt + ``` - On Linux and macOS : +4. Define environment variables - ``` - sudo npm install apidoc -g - ``` + - On Windows : + On Linux and macOS : - ``` - npm install apidoc -g - ``` + ``` + export FLASK_ENV=development + export FLASK_APP=app.py + ``` -### Generating documentation + On Windows : -1. Run these command on the folder project + ``` + set FLASK_ENV=development + set FLASK_APP=app.py + ``` - On Linux and macOS : +## Starting the web server (REST API) - ``` - apidoc -i src/ -o doc/apidoc - ``` +``` +python -m flask run +``` - On Windows : +## Starting the web client - ``` - apidoc -i src\ -o doc\apidoc - ``` +http://localhost:5000/ +or +127.0.0.1:5000 -### Printing documentation + -Go into the /doc/apidoc directory and open the index.html file \ No newline at end of file diff --git a/lab5/src/maps/README.md b/lab5/src/maps/README.md index 59938192ad39944424a8c727d50cf197e7614849..757fc196ffdf7bb051093fbf4747ef16a42f9bb6 100644 --- a/lab5/src/maps/README.md +++ b/lab5/src/maps/README.md @@ -1,9 +1,15 @@ # Maps -A map is represented by a 21x21 pixel image in '.png'. -Each pixel may represent a different element dependindg on its color in RGB +A map is represented by a 21x21 pixel image in `.png`. +Each pixel may represent a different element depending on its color in RGB + * Walls : blue pixels `0x0000FF` -* Path : black pixels `0x000000`. The path may also be represented by Food, Special food, Pac man spanw zone, Enemies spwan zone + +* Path : black pixels `0x000000`. The path may also be represented by Food, Special food, Pac man spawn zone, Enemies spawn zone + * Food : green pixels `0x00ff00` + * Special food : white pixels `0xffffff` -* Pac man spanw zone : yellow pixel `0xffff00` -* Enemies spwan zone : red pixels `0xff0000` \ No newline at end of file + +* Pac man spawn zone : yellow pixel `0xffff00` + +* Enemies spawn zone : red pixels `0xff0000` \ No newline at end of file diff --git a/lab5/src/static/js/GameManager.js b/lab5/src/static/js/GameManager.js index 9c4161cc23b2e41698744e54cadafab3db988545..dc1d3d24046cd26faa98652e30295d8ba106b12f 100644 --- a/lab5/src/static/js/GameManager.js +++ b/lab5/src/static/js/GameManager.js @@ -159,6 +159,14 @@ window.addEventListener("keydown", function (event) { //change player direction if (KEYS[event.code]) player.setDirection(KEYS[event.code]); + + if (event.code == "KeyI"){ + camera.position.z -= 0.5; + } + + if (event.code == "KeyO"){ + camera.position.z += 0.5; + } });