HTML and CSS Reference
In-Depth Information
Tanks That Pass Through Walls?
In Example 8-19 , wearegoingtodemonstrate howapoorlydesignedtile mapcanallowfora
nodepathtoseemingly gothroughsolidwallswhendiagonal movement isallow. Figure 8-19
shows this occurring. Here is the full code listing for Example 8-19 .
Example 8-19. Maze design with tank going through walls
<!doctype html>
<html
<html lang= "en" >
<head>
<head>
<meta
<meta charset= "UTF-8" >
<title>
<title> Chapter 8 Example 19 - A* With Tank Animation with diagoinal moves </title>
</title>
< script src = "modernizr.js" >< /script>
< script type = 'text/javascript' src = 'graph.js' >< /script>
< script type = 'text/javascript' src = 'astar.js' >< /script>
< script type = "text/javascript" >
window . addEventListener ( 'load' , eventWindowLoaded , false
false );
function
function eventWindowLoaded () {
canvasApp ();
}
function
function canvasSupport () {
return
return Modernizr . canvas ;
}
function
function canvasApp (){
iif ( ! canvasSupport ()) {
return
return ;
} else
else {
var
var theCanvas = document . getElementById ( 'canvas' );
var
var context = theCanvas . getContext ( '2d' );
}
var
var currentNodeIndex = 0 ;
var
var nextNode ;
var
var currentNode ;
var
var rowDelta = 0 ;
var
var colDelta = 0 ;
var
var tankX = 0 ;
var
var tankY = 0 ;
var
var angleInRadians = 0 ;
Search WWH ::




Custom Search