Please help!

Videos around the RTS tutorial series
Post Reply
Radicals
Posts: 2
Joined: Mon Oct 06, 2014 7:12 am

Please help!

Post by Radicals »

Hi!

I found your tutorials SO helpful, I wanted to firstly thank you for taking the time to make them.

My question is, I'm at video 2 & 3, but my code is not showing my tables/css properly.
I swear I have copied your code verbatim, yet something still causes it to show improperly.
Please see below....

I have a 100x100 png of a green background, which is in my images directory and it just never shows up (as the background).

it's like all 3 areas of the game are overlapping or something?

Any help is appreciated!

(Bunker is the title of my game...)


Image
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Please help!

Post by hallsofvallhalla »

show us your code.
Radicals
Posts: 2
Joined: Mon Oct 06, 2014 7:12 am

Re: Please help!

Post by Radicals »

Of course.
I have made a database in localhost but the DB is empty at this point.
I have a few images in my /images folder (logo.png, grassback1.png, build.png)
And a few houses (1 through 3) and tower.png in the buildings folder.


connect.php
----------------------------
<?php
$db = @mysql_connect("localhost", "root", "") or die("Could not connect.");
if(!$db)
die("no db");
if(!mysql_select_db("rts",$db))
die("No database selected.");

?>
----------------------------
index.php
----------------------------
<?php
include_once 'connect.php';
?>
<link href="style.css" rel="stylesheet" type="text/css">

<script type="text/javascript" src="gamelib/gamelib_core.js"></script>
<script type="text/javascript" src="gamelib/gamelib_sprites.js"></script>
<script type="text/javascript" src="gamelib/gamelib_mouse.js"></script>
<script type="text/javascript" src="mainfunctions.js"></script>
<script type="text/javascript">
var buildingselected = 0;
var offsetmap = document.getElementById('maparea').offsetLeft;
//alert (offsetmap);
</script>
<div id="wrapper">
<body onLoad="if(!Gl_browser.panic)init()" >

<div id="logo"></div>
<div id="panelarea">
<?php include "panel.php"; ?>
</div>
<div id="maparea" onClick="checkelement();"></div>
<div id="rpanelarea" align="center">
<?php include "rpanel.php"; ?>
</div>
-------------------------------------------------
mainFunction.js
-----------------------------------------------
function init(){
Sp_linuxcompatible=true;

house=new SP_Sprite();
house.setImage("images/buildings/house_1.png",100,83);
house.setXlimits(offsetmap, offsetmap +175);
house.setYlimits(110, 590);
house.setFrame(0);
house.switchOn();
house.setZ(8);
house.moveTo(-100,-100);

Gl_hook("game_loop()");

Gl_scrollbars("no");
themouse=Ms_initmouse();
Gl_start();
start_rpanel();

}

//main game loop//
function game_loop()
{

}

function selectedbuilding(building)
{
buildingselected = 1;
document.getElementById('selectedbuilding').innerHTML="<img src='images/buildings/" + building + "_3.png'>"
}

function checkelement()
{
if(buildingselected == 1)
{
house.moveTo(themouse.x,themouse.y);
}
}
-----------------------------------------------------
panel.php
------------------------------------------------
<u>Selected Unit</u>
<div id="selectedbuilding></div>
------------------------------------------------
rpanel.php
-----------------------------------------------
<img src="images/build.png" />
<img src="images/buildings/house_3.png" onClick="selectbuilding('house');" /><br />House<br />
<img src="images/buildings/tower_3.png" onClick="selectbuilding('tower');" /><br />Tower<br />

<script type="text/javascript">

</script>
--------------------------------------------------
style.css
------------------------------------------
#wrapper {
margin-left:auto;
margin-right:auto;
width:1000px;
font-family:Georgia, "Times New Roman", Times, serif;
font-size:13px;
}

#logo {
background-image:url(images/logo.png);
width:800px;
height:100px;
z-index:0;
}

#maparea {
background-image:url(images/grassback1.png);
background-repeat:repeat;
width: 500px;
height: 500px;
z-index:2;
float:left;
}

#panelarea {
border: 1px solid black;
width: 100px;
height: 500px;
z-index:2;
float:left;
}

#rpanelarea {
border: 1px solid black;
width: 98px;
height: 500px;
z-index:2;
float:left;
}
-------------------------------------------------------
Post Reply

Return to “Browser based RTS Videos”