HTML and CSS Reference
In-Depth Information
context . closePath ();
//draw red circle at end node
context . beginPath ();
context . strokeStyle = "red" ;
context . lineWidth = 5 ;
context . arc (( endNode . y * 32 ) + 16 , ( endNode . x * 32 ) + 16 , 10 , 0 ,
( Math . PI / 180 ) * 360 , false
false );
context . stroke ();
context . closePath ();
//draw black circles on path
for
for ( var
var ctr = 0 ; ctr < result . length - 1 ; ctr ++ ) {
var
var node = result [ ctr ];
context . beginPath ();
context . strokeStyle = "black" ;
context . lineWidth = 5 ;
context . arc (( node . y * 32 ) + 16 , ( node . x * 32 ) + 16 , 10 , 0 ,
( Math . PI / 180 ) * 360 , false
false );
context . stroke ();
context . closePath ();
}
iif ( ! finishedPath ) {
iif ( ! tankStarted ) {
currentNode = startNode ;
tankStarted = true
true ;
nextNode = result [ 0 ];
tankX = currentNode . x * 32 ;
tankY = currentNode . y * 32
}
iif ( tankX == nextNode . x * 32 && tankY == nextNode . y * 32 ) {
//node change
currentNodeIndex ++ ;
iif ( currentNodeIndex == result . length ) {
finishedPath = true
true ;
}
currentNode = nextNode ;
nextNode = result [ currentNodeIndex ]
tankMoving = false
false ;
}
iif ( ! finishedPath ) {
iif ( nextNode . x > currentNode . x ) {
Search WWH ::




Custom Search