Problem with CSS

Location of the Videos
Post Reply
Hotke
Posts: 19
Joined: Fri Jul 02, 2010 12:58 pm

Problem with CSS

Post by Hotke »

Hi all,

I was doing the tutorials from Halls for the MMO 1 year ago and got stuck with the CSS and quit. Now I picked it up again and got stuck again on CSS.

Most of you are wondering how someone can get stuck on CSS, its so simple! I'm wondering that too! :?

Okay this is my problem. Im at the 8a and b videos and made my style sheet styl.css then I made the div tags the same as done in the videos

Code: Select all

body {
	background-color: #ffffff;
}
#login {
	position:absolute;
	left:0px;
	top:0px;
	width:800px;
	height:150px;
	z-index:1;
}
#login2 {
        position:absolute;
        left:0px;
        top:200px;
        width:800px;
        height:150px;
        z-index:1;
}
#player {
        position:absolute;
        left:400;
        top:200px
        width:450px;
        height:450px;
        z-index:3;
}
#creature {
          position:absolute;
          left:400;
          top:400px;
          width:450px;
          height:450px;
          z-index:3;
}
#logout {
        position:absolute;
        left:10px;
        top:10px;
        width:150px;
        height:150px;
        z-index:3;
}
Then I placed them in battle.php and attack.php like in the videos

Battle.php

Code: Select all

<?php
include_once 'connect.php';
 session_start();
////////new video 8/////////
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">


<?php

if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
?>
</div>
<?php
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die ("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];


//////////video 7////////
if (isset($_GET['randid']))
{
  $randid=$_GET['randid'];
  $iteminfo="SELECT * from inventory where randid='$randid'";
  $iteminfo2=mysql_query($iteminfo) or die ("could not get item stats!");
  $iteminfo3=mysql_fetch_array($iteminfo2);

  if(!$iteminfo3['name'])
  {
  }
  else
  {
    $name = $iteminfo3['name'];
    $stats = $iteminfo3['stats'];
    $statadd = $iteminfo3['statadd'];
    $type = $iteminfo3['type'];

    if ($type == "healing")
    {
      $newhp = $statadd + $playerhp;
      if ($newhp > $playerinfo3['maxhp'])
      {
        $newhp = $playerinfo3['maxhp'];
      }
      $updateplayer="update players set hpoints='$newhp' where name='$player'";
      mysql_query($updateplayer) or die ("Could not update player");
      
      $updateitem="DELETE from inventory where name='$name' AND randid='$randid' limit 1";
      mysql_query($updateitem) or die ("Could not delete item");
      
      $playerhp = $newhp;
     
    echo "Used " . $name . " and recovered " . $statadd . ".<br>";
    }
    
  }}
  ////////////////////////////////



if (isset($_GET['creature']))
{
  $creature=$_GET['creature'];
  $creatureinfo="SELECT * from creatures where name = '$creature'";
  $creatureinfo2=mysql_query($creatureinfo) or die ("couldn't get the creature you were fighting!");
  $creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
  $creatureinfo="SELECT * from creatures order by rand() limit 1";
  $creatureinfo2=mysql_query($creatureinfo) or die ("could get a creature!");
  $creatureinfo3=mysql_fetch_array($creatureinfo2);
}

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];



?>
<div id="player">
<?php
///////////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Hit points = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";
?>
</div>
<div id="creature">
<?php
//////////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Hit points = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";

echo "<a href='attack.php?creature=$creature'>Attack!";
echo "<br><a href='useitem.php?creature=$creature'>Use Item";
echo "<br><a href='store.php?creature=$creature'>Go to Store";

?>
</div>

<div id="logout">
<?php
echo "<br><a href='logout.php'><img src='images/logout.gif'>";
?>
</div>

But the when I try it on the localhost the divs are all over the place. here a link to a SS I made
http://imageshack.us/photo/my-images/684/battlephp.jpg/

I dont understand it, so if somebody has an idea let me know!
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Problem with CSS

Post by OldRod »

<div id="login2" div align="center">
I don't think you need that second 'div' in there do you?

Not sure if that's causing the problem, but you might check it.
Hotke
Posts: 19
Joined: Fri Jul 02, 2010 12:58 pm

Re: Problem with CSS

Post by Hotke »

Removed it and it didnt change anything.

I just retyped that from the videos. So dont know if it is necessary

And that div is only used when the login fails. But that doesnt happen.

Thanks anyway
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Problem with CSS

Post by hallsofvallhalla »

dont code until video 14 or higher. Trust me. Pass it on up and move on in the videos.
Hotke
Posts: 19
Joined: Fri Jul 02, 2010 12:58 pm

Re: Problem with CSS

Post by Hotke »

do you mean that because of the statpanel?

Im just going on with the videos, not doing anything on my own, no personal ideas.
Post Reply

Return to “Older Browser MMO Videos”