Jump to content

Archived

This topic is now archived and is closed to further replies.

codenature

X/Y coordinate system for game areas question

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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
:thumb-up: Sounds good.  Play with it to get a feel for it, and don't be afraid to ask more questions if you need to tweak the design.

Share this post


Link to post
Share on other sites

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