![]() |
homecontact ussitemapadvertising | |||
|
|
||||
The Free MMORPG Games- Free MMORPG - P2P Games - Open Beta - Closed Beta - Browser Based - Non-English - Other Free Games - Top 50
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Marios's Mustache Wax
Join Date: Mar 2007
Posts: 7
![]() MMOFaces Profile:
None Yet
|
I Need help with making a Text Base MMORPG, i am looking to make one like www.gangbliss.com, www.don-city.com and www.gangparadise.com etc..
I know HMTL and PHP and the basics of MySQl and i also own www.tech-hosting.co.uk But i dont know how to make a Text Based MMORPG could somebody either help me out or tell me. you can also add me or email me at lilgazza2005@hotmail.com. |
|
|
|
|
|
#2 (permalink) |
|
Cloud's Hair Spray
Join Date: Jul 2006
Posts: 61
![]() MMOFaces Profile:
None Yet
|
well.. based what u type here.. i have 1 suggestion for you..
never give up on a things.. same like me.. i waana create a game based-php. well to avoid spam.. i will give you my script.. enjoy and dont die trying tes.php Code:
<?
//same as tes1.php but use class
class Vegetable {
var $edible;
var $color;
function Vegetable($edible, $color="green")
{
$this->edible = $edible;
$this->color = $color;
}
function is_edible()
{
return $this->edible;
}
function what_color()
{
return $this->color;
}
} // end of class Vegetable
class game
{
var $xO, $y0;
var $x1, $y1;
var $boxShow=5, $sizeBox=50;
var $filename;
var $statPos, $aMaxSize, $statMove;
function game($filename){
$this->filename=$filename;
}
function parse($nm, $val){
$this->$nm = $val;
}
function show($nm){
return $this->$nm;
}
function openMap(){
$handle = fopen($this->filename, "r");
$contents = "";
while (!feof($handle)) {
$contents .= fread($handle, 500);
}
$posX=1; $posY=1;
for($i=0;$i<=strlen($contents);$i++){
if(strtoupper( $contents[$i])){
$statPos[$posX][$posY]=$contents[$i];
}else{
$statPos[$posX][$posY]="";
}
if($contents[$i] =="\n"){
$posY++;
$posX=1;
}else{
$posX++;
if($iMaxX <$posX) $iMaxX=$posX;
}
}
$posY++;
$this->aMapSize=array($iMaxX, $posY);
$this->statPos=$statPos;
fclose($handle);
}
function prevMap(){
$statPos=$this->statPos;
$txt.="<pre>";
$aMapSize=$this->aMapSize;
$iMaxX=$aMapSize[0]; $posY=$aMapSize[1];
for($i=0;$i<$posY;$i++){
for($j=0;$j<$iMaxX;$j++){
if($statPos[$j][$i]==0 || $statPos[$j][$i]==""){
$txt.=" ";
}else{
$txt.=$statPos[$j][$i];
}
}
$txt.="\n";
}
$txt.="</pre>";
return $txt;
}
function mapSize(){
$aMapSize=$this->aMapSize;
$iMaxX=$aMapSize[0]; $posY=$aMapSize[1];
$txt.="size = 0,0 - $iMaxX, $posY";
$txt.= " = ". (1+$iMaxX)* (1+ $posY)." box";
return $txt;
}
function moveOnMap(){
$aMapSize=$this->aMapSize;
$iMaxX=$aMapSize[0]; $posY=$aMapSize[1];
$statPos=$this->statPos;
$txt.="<hr>$target";
if(is_array($_POST) && $_POST[posY0]>0){
foreach($_POST as $nm=>$val){
// $txt.="<br>$nm $val\n";
$$nm= $val;
}
//$txt.="<hr>pos array $posX0 $posY0";
$this->x0=$posX0; $this->y0=$posY0;
$iPosX1=$posX0;
$iPosY1=$posY0;
if($target=="Atas"){
$iPosY1=$posY0-1;
}
if($target=="Bawah"){
$iPosY1=$posY0+1;
}
if($target=="Kanan"){
$iPosX1=$posX0+1;
}
if($target=="Kiri"){
$iPosX1=$posX0-1;
}
if($statPos[$iPosX1][$iPosY1]!=" "&&$statPos[$iPosX1][$iPosY1]!=0){
$ulang=99; //ulang dipakai untuk random posisi
}else{
$iPosX1=$posX0;
$iPosY1=$posY0;
$txtErr.="<h3>MELEWATI BATAS</h3>";//.$statPos[$iPosX1][$iPosY1];
$ulang=99; //ulang dipakai untuk random posisi
}
}
while($ulang<15){
$iPosX1 = mt_rand(0, $iMaxX-1);
$iPosY1 = mt_rand(0, $posY-1);
$txt.="<br>$ulang posisi [ $iPosX1 ][ $iPosY1 ]".$statPos[$iPosX1][$iPosY1];
if($statPos[$iPosX1][$iPosY1]!=" "&&$statPos[$iPosX1][$iPosY1]!=0){
$ulang=100;
}
$ulang++;
}
$txt.="<br>posisi [ $iPosX1 ][ $iPosY1 ]";
//print $txt;exit();
$this->x1=$iPosX1; $this->y1=$iPosY1;
return $txt;
}
function prevMap2(){
$aMapSize=$this->aMapSize;
$iMaxX=$aMapSize[0]; $posY=$aMapSize[1];
$iPosX1=$this->x1; $iPosY1=$this->y1;
$statPos=$this->statPos;
$txt.= $this->x1."<pre>";
for($j=1;$j<$iMaxX;$j++){
$i2=($j+10) %10;
$txt.=$i2;
}
$txt.="<br>";// $iPosY1 $iPosX1<hr>";
for($i=0;$i<$posY;$i++){
for($j=0;$j<$iMaxX;$j++){
if($i==$iPosY1 && $j==$iPosX1){
$txt.="<b>X</b>";
}else{
$txt.=$statPos[$j][$i];//."|$i=$iPosY1 $j=$iPosX1";
}
}
//$txt.="\n";
}
$txt.="</pre>";
$txt.="<br>posisi [ $iPosX1 ][ $iPosY1 ]";
//print $txt;
return $txt;
}
function txt2colour(){
$maxKotak=$this->boxShow;
$aMapSize=$this->aMapSize;
$iMaxX=$aMapSize[0]; $posY=$aMapSize[1];
$iPosX1=$this->x1; $iPosY1=$this->y1;
$statPos=$this->statPos;
$width=$maxKotak*$this->sizeBox;
$txt2.="\n <table border=0 width=".$width." bgcolor=#FFFFCC>";
for($i=1;$i<$maxKotak;$i++){
$txt2.="\n<tr height=50>";
for($j=1;$j<$maxKotak;$j++){
$x=($iPosX1-($maxKotak-1)/2)+$j;
$y=($iPosY1-($maxKotak-1)/2)+$i;
if($statPos[$x][$y]==1){
$bgcolor="00ffff";
}elseif($statPos[$x][$y]==2){
$bgcolor="12FF12";
}elseif($statPos[$x][$y]==3){
$bgcolor="00EF45";
}elseif($statPos[$x][$y]==4){
$bgcolor="00DD00";
}elseif($statPos[$x][$y]==5){
$bgcolor="FFFF00";
}else{
$bgcolor="";
}
$show="";
if($y==$iPosY1 && $x==$iPosX1){
$show="<center>you</center>";
}
$txt2.="\n<td width=50 ";
if($bgcolor!="") $txt2.="bgcolor=#$bgcolor";
$txt2.=">$show </td>";
}
$txt2.="\n</tr>";
}
$txt2.="\n</table>";
return $txt2;
}
function checkPos(){
$maxKotak=$this->boxShow;
$aMapSize=$this->aMapSize;
$iMaxX=$aMapSize[0]; $posY=$aMapSize[1];
$iPosX1=$this->x1; $iPosY1=$this->y1;
$statPos=$this->statPos;
$statYou=$statPos[$iPosX1][$iPosY1];
$statYouUp=$statYou+1; $statYouDown=$statYou-1;
if($statYouDown<1) $statYouDown=1;
//north??
if($statPos[$iPosX1][$iPosY1-1]==$statYouUp ||
$statPos[$iPosX1][$iPosY1-1]==$statYouDown||
$statPos[$iPosX1][$iPosY1-1]==$statYou){
$statMove["N"]=true;
// print $statPos[$iPosX1][$iPosY1-1]."==$statYouUp || ".$statPos[$iPosX1][$iPosY1-1]."==$statYouDown";
}
if($statPos[$iPosX1][$iPosY1+1]==$statYouUp ||
$statPos[$iPosX1][$iPosY1+1]==$statYouDown||
$statPos[$iPosX1][$iPosY1+1]==$statYou){
$statMove["S"]=true;
}
if($statPos[$iPosX1-1][$iPosY1]==$statYouUp ||
$statPos[$iPosX1-1][$iPosY1]==$statYouDown||
$statPos[$iPosX1-1][$iPosY1]==$statYou){
$statMove["W"]=true;
}
if($statPos[$iPosX1+1][$iPosY1]==$statYouUp ||
$statPos[$iPosX1+1][$iPosY1]==$statYouDown||
$statPos[$iPosX1+1][$iPosY1]==$statYou){
$statMove["E"]=true;
}
$this->statMove=$statMove;
}
function button(){
$txt='<form method="post" >';
$iPosX1=$this->x1; $iPosY1=$this->y1;
$statMove=$this->statMove;
$txt.="<input type=hidden value=$iPosY1 name=posY0>
<input type=hidden value=$iPosX1 name=posX0>";
$txt.="<input type=hidden value=".$this->filename." name=map>";
if($statMove[N]==true){
$inpButton[n]='<input type="submit" value="Atas" name=target>';
}
if($statMove[S]==true){
$inpButton[s]='<input type="submit" value="Bawah" name=target>';
}
if($statMove[W]==true){
$inpButton[w]='<input type="submit" value="Kiri" name=target>';
}
if($statMove[E]==true){
$inpButton[e]='<input type="submit" value="Kanan" name=target>';
}
$txt.='
<table width="50" border="1" summary="">
<tr>
<td align="center" valign="middle" colspan="2">'.$inpButton[n].
' </td>
</tr>
<tr>
<td valign="middle">'.$inpButton[w].
' </td>
<td valign="middle">'.$inpButton[e].
' </td>
</tr>
<tr>
<td align="center" valign="middle" colspan="2">'.$inpButton[s].
' </td>
</tr>
</table>
</form>';
return $txt;
}
}
class gameChar extends game {
var $uX, $uY;
function checkScript(){
$filename=substr($this->filename,0,-4).".php";
$userX=$this->x1;
$userY=$this->y1;
include($filename);
}
}
$cGame = new gameChar("map1.txt");
if($_POST[map]){
$cGame->parse("filename", $_POST[map]);
}
/*if($_POST){
foreach($_POST as $nm=>$val){
$txt.="<br>$nm $val\n";
$$nm= $val;
}
}
print $txt;
*/
$cGame->openMap();
$cGame->prevMap();
$cGame->moveOnMap();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Created on: 19/04/2007 -->
<head>
<title></title>
</head>
<body><?
$cGame->checkScript();
print $cGame->txt2colour();
$cGame->checkPos();
print $cGame->Button();
print $cGame->prevMap2();
?>
</body>
</html>
Code:
111112211111
111111111111 1111111111
113321 11111111221113
11331111111111311113331121 111112211111
112232112111 11151411111 321
113321 11111111221113 22
1133111111111131111333112111112333333
111111111111111121111111
111111 11111221221111
111111 11111211211111
111111 11111111111111
1112423243211111121111111
111111 11111221221111 1131211121
111111 11111211211111 122111111
111111 11111111111111 112111
111112211111 121121
111111111111 1111111111 12121212
113311 11111111221113 12312
11331111111111311113331121 1231213321
11111111222112 123132133 11111111121111111
111111 11111221221111212
111111 11111211211111
111111 11111111111111
Code:
<?
//userX userY
if(
$userX==1 &&
$userY==5){
$this->filename="map2.txt";
//20,48
$this->x1=38;
$this->y1=6;
$this->openMap();
//print $this->prevMap();
//$this->prevMap2();
}
?>
Code:
2211111
111111 1111111111
113321 11111111221113
11331111111111311113331121 111112211111
2111 11151411111 321
113321 11111111221113 22
1133111111111131111333112111112333333
111111111111111121111111
111111 11111221221111
111111 11111211211111
111111 11111111111111
1112423243211111121111111
111111 11111221221111 1131211121
111111 11111211211111 122111111
1 11 11111111111111 112111
111112211111 121121
111111111111 1111111111 12121212
113311 11111111221113 12312
11 3 111111111311113331121 1231213321
11 111222112 123132133 11111111121111111
111111 11111221221111212
111111 11111211211111
111111 11111111111111
2211111
111111 1111111111
113321 11111111221113
11331111111111311113331121 111112211111
2111 11151411111 321
113321 11111111221113 22
1133111111111131111333112111112333333
11332211111111111121111111
111111 11111221221111
111111 11111211211111
111111 11111111111111
1112423243211111121111111
111111 11111221221111 1131211121
111111 11111211211111 122111111
1 11 11111111111111 112111
111112211111 121121
111111111111 1111111111 12121212
113311 11111111221113 12312
11 3 111111111311113331121 1231213321
11 111222112 123132133 11111111121111111
111111 11111221221111212
111111 11111211211111
111111 11111111111111
there someone can help me.. in map1.php.. i want to use this step Code:
<map name=map1>
<position x=1 y=3>
move("map2.txt", 38,6);
</position>
</map>
Last edited by landavia : 04-23-2007 at 03:05 AM. Reason: the post are tooo long.. is fine type whole? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Copyright © 2004-2007 BlueCastle Media |