Hi Everyone,
I try to create a very simple labyrinth game with php. I set up PHP array for the Cardinal directions (North, East, South and West). Here’s an example :
$nord=array(0=>-1, 1=>-1, 2=>-1, 3=>-1, 4=>-1,);
the same for enigmas
$enigmes=array(
0=>"…",
1=>"",
);
Here’s the code, the player enters the room $piece (room), click on the direction to reach the next room and so on.
$piece = 0;
if(isset($_GET[“numpiece”])) {
$piece = $_GET[“numpiece”];
}
if($sud[$piece] !== -1) {
echo ‘SUD’;
translation piece=room ; sud = south ; numpiece=room number.
My problem is, and I’ve tried to resolve it but in vain… I don’t know where to embed my $enigmes (enigmas) within the code above. I need to write a very short text to inform the player he has reached the room x (you reach the room # . This text must appear above the doors.
echo “Vous êtes dans la pièce … $piece[$piece]”;
Thank you so much for your help.
Cheers