Display a game board in a web page with json only using js and ajax

Display a game board in a web page with json only using js and ajax
0.0 0

#1

Hello,
I 'm french so sorry for the mistakes…:roll_eyes: ,
I’m beginner in json and try to make a game board with json, I have my map (table of numbers) in json and my js file:
$.ajax({
url:“json.json”,
type:“GET”,
success:function(data){
console.log(data.Map);
},
error: function (jqXHR, textStatus, errorThrown){
alert(textStatus + errorThrown);
}
json:
{
“Map”:[
[0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0]
]
}

How to display the board in my web page …? I need to know also how to display pictures (characters and weapons) randomly on the board, can you help me please !! (I have to use constructor …)
I am looking for good tutorials to create games in 2D in js …
Thanks a lot!!


#2

Here are a couple of tutorials for you to look at to learn basic 2D game creation with modern HTML5 and Canvas:

Pick one and then go through it. Retype all the code so you get a feel for what it takes to make the game work (don’t just copy and paste).

After you understand that a little, stark tweaking the code until it does what you want it to do. Take your board data and draw it on the screen instead of using the stuff from the tutorial, for example.

Good luck! Ask more specific questions if you get stuck in the process.


#3

Thank you J.D for you help !!