| 361 | } |
| 362 | |
| 363 | function drawSpriteImg(coord) { |
| 364 | var offsetLeft = cellSize / 50; |
| 365 | var offsetRight = cellSize / 25; |
| 366 | ctx.drawImage( |
| 367 | sprite, |
| 368 | 0, |
| 369 | 0, |
| 370 | sprite.width, |
| 371 | sprite.height, |
| 372 | coord.x * cellSize + offsetLeft, |
| 373 | coord.y * cellSize + offsetLeft, |
| 374 | cellSize - offsetRight, |
| 375 | cellSize - offsetRight |
| 376 | ); |
| 377 | if (coord.x === maze.endCoord().x && coord.y === maze.endCoord().y) { |
| 378 | onComplete(moves); |
| 379 | player.unbindKeyDown(); |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | function removeSprite(coord) { |
| 384 | var offsetLeft = cellSize / 50; |