Skip to content

Ajout des attributs type et position dans game.php et modification de… - #1

Open
MisterSCO wants to merge 1 commit into
mainfrom
f_step1
Open

Ajout des attributs type et position dans game.php et modification de…#1
MisterSCO wants to merge 1 commit into
mainfrom
f_step1

Conversation

@MisterSCO

Copy link
Copy Markdown
Owner

… la fonction displayPlayers

@MisterSCO
MisterSCO requested a review from F2000-FR February 16, 2021 17:49
Comment thread game.php
'health' => '100',
'strength' => '50') );

define('WIZZARD', array(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Attention un seul 'Z' !

Comment thread game.php
Comment on lines +10 to +13
define('WARRIOR', array(
'classe' => 'Warrior',
'health' => '100',
'strength' => '50') );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm ! Intéressant ! Je n'avais pas pensé à une solution de ce type qui pourrait être envisageable si on considérait que les valeurs "force", "santé", "mana" soient fixes pour chaque type de personnage (guerrier, magicien).
Là, on souhaiterait pouvoir garder des données variables. Donc ne pas changer autant de choses dans le code finalement.

Juste garder les constantes WARRIOR, WIZARD, STEALTH (THIEF?) en variable simple (= valeur numérique par ex : 1/2/3).

Après, on aura pu garder une partie de votre logique, en ayant des clés de tableaux comme :

min_health
max_health
min_strength
max_strength
...
cela aurait pu permettre de préparer une génération automatique des caractéristiques du personnage en fonction de leur classe tout en gardant certaines "bornes" logiques (ex: un guerrier est souvent plus fort qu'un magicien, etc.)

Mais restons simple pour le moment ;)

Comment thread game.php
Comment on lines +53 to +54
'y' => 0,
'x' => 1,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait réutiliser rand ( ) pour rajouter un peu d'aléatoire mais une bonne idée d'avoir deux clés "x" et "y" 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants