note 36802 added to tutorial.firstpage
| From: | kawasaki100srj at aol dot com | Date: | Thu, 23 Oct 2003 03:48:51 +0000 |
| Subject: | note 36802 added to tutorial.firstpage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59151@lists.php.net to get a copy of this message | ||
I need help with my game....
For my first file "Main.php", i have this code:
------------------------------------------------------------
<title>RED SUMMER [TEST ROUND]</title>
<?
include("config.php");
?>
<center><table border=2 bordercolor=black cellspacing=2 cellpadding=2 width=400>
<td>
Points:<? echo $points; ?>
<td>
<td>
Money:<? echo $my_money; ?>
</td>
</table><br>
<center>
<table border=2 bordercolor=black cellspacing=2 cellpadding=2 width=200>
<td>
<input type=radio name='name' value="<? echo $name1;
?>">Peasant<br>
<form action="attack.php">
<form method=post>
<input type=submit name="submit" value="Attack">
____________________________________________________
And for the "config.php" file, i have this:
____________________________________________________
<?
//these are the vars for starting money and starting points.
$start_points = 5;
$start_money = 100;
//now time for the in game vars.
$my_points = 0 ;
$money = '' ;
$points = $totalpoints ;
//Now the names of the enemies.
$enemy_name1 = 'Peasant' ;
//Now time for the enemy points...
$name1 = 2 ;
//the chance that a player will win battle.
$combat_rand = rand('1','2');
//what the player gets after winning(if he/she does win.)
$combat_points = rand('1','10');
?>
____________________________________________________
And now for the "attack.php" file, i have this:
____________________________________________________
<?
include("config.php");
if ($combat_rand == '1') ;
$points = $totalpoints + $combat_points
{
print ("You have killed a $enemy_name1 and won $points points!!!")
} ;
?>
Click <a href="main.php">here</a> to return.
____________________________________________________
But when you click the link to go back to "main.php" all it shows in the $point place is
blank... Can someone help me on how to get this to add to the $points everytime they DO win?
The $combat_rand is at 50% chance... Pretty much i need to get the code right to where if the
chance = 1, it needs to add rand('1','10') to the $points.
PLEASE help on this code, it is kinda like a calulator, exept adding to the result every time.
----
Manual Page -- http://www.php.net/manual/en/tutorial.firstpage.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36802
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36802&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36802&report=yes
Search -- http://master.php.net/manage/user-notes.php