Jump to content

X/Y coordinate system for game areas question


codenature

Recommended Posts

Hi, I am making a game and I want the player to use a coordinate system using North, South, East, and West form buttons to navigate the virtual X Y coordinates. The only problem is, if I want to put a monster at location

 

x=100

y=100

 

The player would have to move to that particular tiny dot on the grid, so the likelihood of them coming in contact with the monster is almost nonexistent. Please, if anyone could please show me a proper way to put into a monster in the database using a coordinate system and then the php check in the form please for the monster coordinates for one example. I can repeat the rest.

 

It seems like I would need to check for a range of points from a virtual square, but that is a lot of numbers!! Thank you.

Link to comment
Share on other sites

I'm not quite sure what your problem is.  Do you only have one monster on the map?  I mean, most games tend to either have monsters placed in locations that the player would have to go through (certain hallways/rooms/in front of doors), so they're guaranteed to encounter them, or have them randomly generated where each move by the player rolls the dice behind the scenes to see if they've stumbled into a fight.

Link to comment
Share on other sites

i realize what you are saying. I am making a field, where I want to player to be able to roam, and when they roam to a certain x y coordinate that I put in the database where a monster exists, they have a monster encounter.

 

so if monster is x100,y100

player hits on that coordinate

fight begins,

problem is there is a very small chance in the whole map of it hitting that spot.

the submit direction form checks for known monster points, and monsters show up as the points are landed on

 

Any better suggestion would be great though. please

Link to comment
Share on other sites

OOPS I guess I didn't realize what you said. The random encounter is GREAT. But I still can't use that for encountering places like towns, caves, castles, etc for a story plot.

 

The biggest thing is figuring out how to both constrain and direct the player.  You need to make parts of your grid inaccessible (like mountains), and you also need to tell the player where to go.  That's how the classic, 2D RPGs worked.

 

With games that rely on a map grid, you're never going to be able to guarantee that a player will hit a certain point on the map unless you force them there.  If exploration/freedom of movement is what you're aiming for, the best you can do is limit where they can go and make the next step of the journey obvious.

Link to comment
Share on other sites

Thank you very much for that insight. I will use random monster die roll generation for the monsters, and then I will direct them to the places like cave, castle, or town. I think I will do this by making "mountain walls" like you said, made up of long lines that say when you hit one let's say the north mountain points in between x-500 and y500, so that will be my long mountain wall, then it says "you have found the north mountain wall, you can go west or east from here"

 

Then if they go east, they will eventually hit the "zone" for the "castle" place with a narrative story. The zone to the castle will be a vertical line from points on the mountain end wall points.

 

does that sound decent?

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.