Jump to content

RPG mapping


avatar.alex

Recommended Posts

Ive searched and I couldn't find anything like this ok...well one of my game developers have created a type of explore system...but its written in javascript and PHP so its hard for me to tweak it...but I need something that moves around like this http://www.bbgamezone.com/map/ but if I have a house or something be able to enter it...some how? IDK...but everythings good just entering the houses, shops, shrines w/e it may be i would like to know how to do this? Heres the topic http://community.bbgamezone.com/index.php/topic,1000.0.html for more detail...but if anyone already knows a source out there that is similar to this feel free to share with me!! thanks

Link to comment
Share on other sites

I have written this however I can't just give it to you.

 

You need to store the map in a table with x/y coordinates and then a terrain type  dirt, grass, tree, town entrance etc.

You need another table with the relationships for the terrans.

 

 

The compass on the top of the page simply is a form that gives the system new coordinates to move the sprite to.

 

So to move all you need to do is query for that

sprites current  location,

query for the square they are moving to location and type

Verify its 1 square away and isn't an inmoveable or special

if special then teleport the user (such as into a town or dungeon)

Update the sprite's X/Y in the database

Then generate the map

 

 

 

 

Link to comment
Share on other sites

i know its not simple but couldn't I just do something like make a table and put x,y cordites in the table along wit map number and so if they land on 3,4 I can make it so its like

 

header("location:map.php?id=".$mapnum.);

 

and it sends them to map 2 or something

 

Pluse i dont have ads in my game...?

Link to comment
Share on other sites

look into basic ajax and try and make a simple form with a button so when you hit it it updates the content area on the page (there are tutorials on this)

then add in 3 more buttons for up/down/left/right and then go back into your ajax action page and beef it up to sync up to your map database.

Link to comment
Share on other sites

you can also download a copy of the open source game made in PHP. Dragon Knight. http://dragon.se7enet.com/dev.php That has a movement system. And a map. however doesn't use the live terrain and sprite stuff that you want. But you will see how things are coded within PHP to make the player move and interact.

do you think that you could help me pull that map system from the game cus you have more EXP with the script?

Link to comment
Share on other sites

the movement part of the game is in explore.php. It makes a function called move(); , to move the character 1 space north, south, east or west. You can easily change the custom functions used in Dragon Knight to normal PHP functions. Such as doquery(). You can change that too mysql_query(); with some minor adjustments in the queries.

 

<?php // explore.php :: Handles all map exploring, chances to fight, etc.

function move() {
    
    global $userrow, $controlrow;
    
    if ($userrow["currentaction"] == "Fighting") { header("Location: index.php?do=fight"); die(); }
    
    $latitude = $userrow["latitude"];
    $longitude = $userrow["longitude"];
    if (isset($_POST["north"])) { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
    if (isset($_POST["south"])) { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
    if (isset($_POST["east"])) { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
    if (isset($_POST["west"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } 
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.