Jump to content

Kryllster

Members
  • Posts

    186
  • Joined

  • Last visited

Everything posted by Kryllster

  1. I am working on a turn based game and I am having some difficulty making the HP counter stop counting at the specified number here is some of the code; <?php session_start(); $player_hp = $_SESSION['player_hp']; $turns = $_SESSION['turns']; $turns = $turns - 1; ?> and this is how I was trying to stop it. <?php if($total_hp < 30){ $player = $player_hp + 5; echo "You Still Have More recovery to do!"; } else { echo "You are fully recovered!"; } $_SESSION['turns'] = $turns; $_SESSION['player_hp'] = $player_hp; ?> I know this is simple but I'm having a heck of a time getting the HP to stop counting at 30. Also here is the code which I use to refresh the page to count it out. <form action="safe-spot.php" method="post"> <input type="hidden" name="sub"> <input type="submit" value="Click Here"> Thanks in advance,
  2. I have some code for my game I'm rewriting and making it a frames based game but the old code doesn't help I have included this piece of code to ask how I could make it go to the target frame within the frame set and not have to change all my links and basically rewrite the whole game. Here is the code if (!in_array($_GET['show'], $accepted)) //$accepted is the array of all accepted page names { echo "That page does not exist"; } else { // navigation pages for the town if($_GET['show'] == "account" || $_GET['show'] == "alley_man" || $_GET['show'] == "alley_view" || $_GET['show'] == "archer" || $_GET['show'] == "armor" || $_GET['show'] == "bank" || $_GET['show'] == "chat" || $_GET['show'] == "cloth" || $_GET['show'] == "crimson" || $_GET['show'] == "garden" || $_GET['show'] == "inn" || $_GET['show'] == "mage" || $_GET['show'] == "main" || $_GET['show'] == "merchant" || $_GET['show'] == "weapons" || $_GET['show'] == "recovery_room") { require_once("dungeons/town/" . $_GET['show'] . ".php"); } I'm trying to make this easier but it seems it would be a hard thing for me to rewrite the game but a friend on here said my game would be good with a front controller but I have no knowledge how to do that. I am not sure if a frames based game would help achieve that?? Anyway any help would be appreciated!! Thanks,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.