Simple Javascript collision detection?
问题 I'm trying to make a simple game using jquery,javascript,html and css. I keep getting stuck on collision detection. code: var map = [ [0,1,0,0,0,1,0,0,], [0,1,0,0,0,1,0,0,], [0,1,0,0,0,1,0,0,], [0,1,1,1,0,1,0,0,], [0,0,0,0,0,0,0,2,] ]; function DrawMap() { for(var i=0; i < map.length; i++){ for(var j=0; j < map[i].length; j++){ if(parseInt(map[i][j]) == 0){ $("#container").append("<div class='air'></div>"); } if(parseInt(map[i][j]) == 1){ $("#container").append("<div class='block'></div>"); }