mardi 21 novembre 2017

How can I go about creating a JS and PHP game that stores user coordinates?

So i'm obviously not knowledgeable about how game development works as I've never tried to make one before.

I've been working on one, which is available here: http://ift.tt/2jd8Hqw

It's mainly queries for everything. Ajax is so that everything auto updates

The key takeaways are: 1. User creates a room and you must wait until someone else joins to start the game

  1. Someone joins, the game can be started.

  2. You both click start the game

  3. You see the information of the person you are going against.

  4. Every time you click attack, it removes hp based on your characters damage in the mysql table.

This is fine, but I just made the battle simple to test how I would want it to work.

Ideally, what I want is after you join a room; you enter a game and you spawn somewhere on the map.

So if the map looked like

[x][x][x][x][x]

[x][x][player][x][x]

[x][x][x][x][player]

Then you would spawn on a random coordinate on the map. I understand that you may need to use an array to generate a map and store the user coordinates in the database?

So how can I mix Javascript and PHP together to achieve a system like this?

Player movements wouldn't be by keys but instead you would use click [left][up][right][down] to move, and it will move you one coordinate up on the map.

Then if both players coordinates are on the same spot, then you can duel the other person.

If I could just be explained how to use Javascript and php to store information, make a map, and call information and such; then i'll be good to go.




Aucun commentaire:

Enregistrer un commentaire