Jump to content

BellQuestWars

Members
  • Posts

    46
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

BellQuestWars's Achievements

Member

Member (2/5)

0

Reputation

  1. aight, I only have one object I'll try clearing image, dont think it will work though... Haha thanks! Didnt think that would work! Still one bug though, when the player is directly under the object, it draws it on the northeast and north box, but probably a simple bug, quick fix. Okay, the problem was I forgot to clear image in North, knew it would be simple...
  2. So I wrote this code, what its supposed to do is draw an image on a grid space, based on its X,Y coordinates from a mySql database, compared to the player X,Y. Heres the code: <table> <tr> <td> <?php //northwest echo "nw"; $x1 = $_SESSION[x] - 1; $y1 = $_SESSION[y] + 1; $hasobject1 = mysql_query("SELECT * FROM objects WHERE x='$x1' && y='$y1'"); while($row = mysql_fetch_array($hasobject1)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> <td><?php //north echo "n"; $x2 = $_SESSION[x]; $y2 = $_SESSION[y] + 1; $hasobject2 = mysql_query("SELECT * FROM objects WHERE x='$x2' && y='$y2'"); while($row = mysql_fetch_array($hasobject2)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> <td><?php //northeast echo "ne"; $x3 = $_SESSION[x] + 1; $y3 = $_SESSION[y] + 1; $hasobject3 = mysql_query("SELECT * FROM objects WHERE x='$x3' && y='$y3'"); while($row = mysql_fetch_array($hasobject3)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> </tr> <tr> <td><?php //wesr echo "w"; $x4 = $_SESSION[x] - 1; $y4 = $_SESSION[y]; $hasobject4 = mysql_query("SELECT * FROM objects WHERE x='$x4' && y='$y4'"); while($row = mysql_fetch_array($hasobject4)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> <td><?php echo "p"; //player echo "<IMG SRC='spaceship_wire5.jpg' WIDTH=64 HEIGHT=64>"; ?></td> <td><?php //east echo "e"; $x5 = $_SESSION[x] + 1; $y5 = $_SESSION[y]; $hasobject5 = mysql_query("SELECT * FROM objects WHERE x='$x5' && y='$y5'"); while($row = mysql_fetch_array($hasobject5)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> </tr> <tr> <td><?php //southwest echo "sw"; $x6 = $_SESSION[x] - 1; $y6 = $_SESSION[y] - 1; $hasobject6 = mysql_query("SELECT * FROM objects WHERE x='$x6' && y='$y6'"); while($row = mysql_fetch_array($hasobject6)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> <td><?php //south echo "s"; $x7 = $_SESSION[x]; $y7 = $_SESSION[y] - 1; $hasobject7 = mysql_query("SELECT * FROM objects WHERE x='$x7' && y='$y7'"); while($row = mysql_fetch_array($hasobject7)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> <td><?php //southeast echo "se"; $x8 = $_SESSION[x] + 1; $y8 = $_SESSION[y] - 1; $hasobject8 = mysql_query("SELECT * FROM objects WHERE x='$x8' && y='$y8'"); while($row = mysql_fetch_array($hasobject8)) { $image = "space_228.gif"; $image = $row[image]; } if(!empty($image)){ echo "<IMG SRC=$image WIDTH=64 HEIGHT=64 onerror='onImgError(this)>'"; } else{ echo "<IMG SRC='space_228.gif' WIDTH=64 HEIGHT=64>"; } ?></td> </tr> </table> Now what happens is it draws the image on a bunch of different spots. The object is at 0,0. It doesnt display the object if the object is out of range of the player, or the player is at 0,0. But if the player is near the object, it draws it on like half the grid spaces, and on some places everywhere but the players. Heres the page, login with test, password test. http://spacetimemmo.webuda.com/login.php
  3. Not much would change for me, except I may have to figure some things out, but that only takes an extra couple of hours. I do lots of things for fun, I visit friends, I read, I play sports, I practice Thai-Chi, I play games with my little brother, etc.
  4. My group of friends at school all have PS3 except one kid who plays X-Box live and hes been laughing at all of us for the past 16 days... They are supposedly giving us a free month of PS+, which doesnt mean shit to me as all I play on my PS3 is Black Ops (I sold MW2 when Black Ops came out, and its the only game I have.) I've been playing more Lord of the Rings Online and practicing programming and the musical (Beauty and the Beast) I'm in for the past 16 days, so its been kinda good (I'm the lead in the play, and I didnt know all my lines.) Lets hope it stays off for mothers day so I actually spend time with my mother (joking.)
  5. I'm sure many of you know this already, but Sony's Playstation network has been down for 15 weeks. It is supposed to come back online this week, but things are looking better as the network goes online in Japan. What are your thoughts on it? Do you think they handled it right? Do you think otherOS is anygood? Is the Playstation network complete crap?
  6. I think I have the displaying of other players figured out, but I cant really test it until my host puts website back on (they check for malicious content 2 days after you open a website, and that takes about 2 days.)
  7. Okay, I have it down. Now how would I make it display all players that are online and on a specific room? Would I do something like in a page called showplayers.php put: <?php require_once("connect.php"); session_start() $map = $_GET[map] $results = mysql_query("SELECT * FROM members WHERE online='true' AND map='$map'"); I dont know what else I would put to get each players X and Y? I would call this page every time the player moves, but then how would I go about displaying the players? I'm stumped on this one.
  8. Okay, so I have a script that uses a php variable to get a number, and the php variable is collected from the database. The problem is the php variable is a string, and the Javascript variable is a number, so I need a way to convert a string into a number. Heres my php script: <?php session_start(); require_once("connect.php"); $result = mysql_query("SELECT * FROM members WHERE username='$_SESSION[username]'"); $x = $row[x]; $y = $row[y]; ?>
  9. Thanks yawl... Been stopping paying attention to this thread for some reason.
  10. Okay, so I fixed the PHP script so that the page does change, it was a simple typo (should have been upercase X and Y in the adress bar...) But now I need to figure out the problem with the AJAX part...
  11. Okay, This code isnt working: if (keyp == 56) { p1y = -1; var url = 'update.php?X='+p1x+'&Y='+p1y; var xhr = new XMLHttpRequest(); this.privates.xhr.open("GET", url, true); xhr.send(null); } This is the code that changes variables when the 8 key is pressed (up on the keypad) But for some reason, when the key is pressed, the players moves up, but nothing changes in the database. Also if I go to the url mypage.com/update.php?x=3&y=3, it doesnt change the datbase. Heres update.php: session_start(); require_once("connect.php"); $x = $_GET[X]; $y = $_GET[Y]; mysql_query("UPDATE members SET x = '$x' WHERE username = '$_SESSION[username]'"); mysql_query("UPDATE members SET y = '$y' WHERE username = '$_SESSION[username]'"); ?>
  12. Okay, This code isnt working: if (keyp == 56) { p1y = -1; var url = 'update.php?X='+p1x+'&Y='+p1y; var xhr = new XMLHttpRequest(); this.privates.xhr.open("GET", url, true); xhr.send(null); } This is the code that changes variables when the 8 key is pressed (up on the keypad) But for some reason, nothing happens when the key is pressed, except for the players movement. Also if I go to the url mypage.com/update.php?x=3&y=3, it doesnt change the datbase. Heres update.php: session_start(); require_once("connect.php"); $x = $_GET[X]; $y = $_GET[Y]; mysql_query("UPDATE members SET x = '$x' WHERE username = '$_SESSION[username]'"); mysql_query("UPDATE members SET y = '$y' WHERE username = '$_SESSION[username]'"); ?>
  13. Oh wait, now I think I understand. I would have the var url = 'update.php?X='+x+'&Y='+y; xmlhttp.open("GET",url,true); xmlhttp.send(); Then on the page update.php, I would have something like: $x=$_GET["X"]; $y=$_GET["Y"]; $query = mysql_query("UPDATE users SET x = '$x' WHERE user = '$_SESSION[user]'"); $query = mysql_query("UPDATE users SET y = '$y' WHERE user = '$_SESSION[user]'"); I'm hoping that code will work. Just posting here first so I dont get frustrated from errors.
×
×
  • 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.