From 18058a130c56ae36838d2ed0cd328eb81dcb9da1 Mon Sep 17 00:00:00 2001 From: "Cedric.dosreis" <cedric.dosreis@gmail.com> Date: Wed, 18 Dec 2019 19:38:45 +0100 Subject: [PATCH] zoom in and out + doc --- lab5/README.md | 39 +++++---- lab5/src/README.md | 140 ++++++++++++------------------ lab5/src/maps/README.md | 16 ++-- lab5/src/static/js/GameManager.js | 8 ++ 4 files changed, 99 insertions(+), 104 deletions(-) diff --git a/lab5/README.md b/lab5/README.md index 0d4e858..fe199e9 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 f1385a2..929ba25 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 5993819..757fc19 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 9c4161c..dc1d3d2 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; + } }); -- GitLab