Hello! :)
Here is a Link to my capx: dl.dropbox.com/u/30036346/Dragon.capx
This is a game for research propourses. It's not even close to the final stage. The aim here is to press spacebar when the timer reaches 0. That way, you can damage the dragon. If you press it on the wrong time (when the dragon is protected by a Dark Aura) you'll get hit by it's fireball.
I've been learning about PHP and AJAX. I read the tutorials avaliable in the FAQ Thread. But I'm not a good programmer and I can't do it properly.
Question: I need to save this CSV file, which must register the time when the player pressed spacebar. Then it goes to another line in the CSV , and when Spacebar is pressed, the timer is registered again. This Way, I can keep track if the player improved his peformance or not.
The data needed are:
Name:
Age:
DragonTimer(which is a variable)
Trial: (how many times the player pressed spacebar so far)
Just like that.
I'm trying to use this code:
<?php
/** Read in a username and score and save them to a file. */
// read variables from POST data.
$username = $HTTP_GET_VARS[name];
$score = $HTTP_GET_VARS[score];
// verify the username is set and not empty
if (!isset($username) || $username == "") {
echo "failure";
exit;
}
// verify the score is set and a number
if (!isset($score) || !is_numeric($score)) {
echo "failure";
exit;
}
// format the username and score as a comma delimited row
$entry = $username . "," . $score . $ DragonTimer "," . "Attempts""\n";
// append entry to the score file
if (!file_put_contents("scores.csv", $entry, FILE_APPEND)) {
echo "failure"; // failed to write to file
exit;
}
echo "success";
?>
Any help is really appreciated. But keep in mind that i'm not a programmer, i'm just a newbie in a adventure which is far beyond my professional field!