Fighing system in Php & MYSQL
Posted
by Gully
on Stack Overflow
See other posts from Stack Overflow
or by Gully
Published on 2010-06-05T19:39:07Z
Indexed on
2010/06/05
19:42 UTC
Read the original article
Hit count: 214
I am working on a game like Mafia Wars and i am trying to get the fighting system working but i keep getting lose trying to work out who is going to win the fight and it still needs to know if the stats are close then there is a random chace of them winning.
$strength = $my_strength;
$otherplayerinfo = mysql_query("SELECT * FROM accounts WHERE id='$player_id'");
$playerinfo = mysql_fetch_array($otherplayerinfo);
$players_strength = $playerinfo['stre'];
$players_speed = $playerinfo['speed'];
$players_def = $playerinfo['def'];
if($players_strength > $strength){
$strength_point_player = 1;
$strength_point_your = 0;
}else{
$strength_point_your = 1;
$strength_point_player = 0;
}
I was trying a point system but i still could not do it.
© Stack Overflow or respective owner