@code-dot-org/maze
Advanced tools
Comparing version 2.0.0 to 2.1.0
{ | ||
"name": "@code-dot-org/maze", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "standalone project for the Maze app type", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -8,2 +8,3 @@ /** | ||
const PlanterCell = require('./planterCell'); | ||
const NeighborhoodCell = require('./neighborhoodCell'); | ||
@@ -15,2 +16,3 @@ module.exports = { | ||
PlanterCell, | ||
NeighborhoodCell | ||
} |
@@ -176,6 +176,6 @@ /** | ||
/** | ||
* Draw the given tile at row, col | ||
* Draw the given tile at row, col from a | ||
* tile sheet that is SQUARE_SIZE * 5 x SQUARE_SIZE * 4 | ||
*/ | ||
drawTile(svg, tileSheetLocation, row, col, tileId, tileSheetHref) { | ||
const [left, top] = tileSheetLocation; | ||
@@ -185,2 +185,32 @@ const tileSheetWidth = SQUARE_SIZE * 5; | ||
this.drawTileHelper( | ||
svg, | ||
tileSheetLocation, | ||
row, | ||
col, | ||
tileId, | ||
tileSheetHref, | ||
tileSheetWidth, | ||
tileSheetHeight, | ||
SQUARE_SIZE | ||
); | ||
} | ||
/** | ||
* Helper function for drawing a tile from a tile sheet | ||
* with the given dimensions and square size. | ||
*/ | ||
drawTileHelper( | ||
svg, | ||
tileSheetLocation, | ||
row, | ||
col, | ||
tileId, | ||
tileSheetHref, | ||
tileSheetWidth, | ||
tileSheetHeight, | ||
squareSize | ||
) { | ||
const [left, top] = tileSheetLocation; | ||
// Tile's clipPath element. | ||
@@ -190,7 +220,7 @@ const tileClip = document.createElementNS(SVG_NS, 'clipPath'); | ||
const tileClipRect = document.createElementNS(SVG_NS, 'rect'); | ||
tileClipRect.setAttribute('width', SQUARE_SIZE); | ||
tileClipRect.setAttribute('height', SQUARE_SIZE); | ||
tileClipRect.setAttribute('width', squareSize); | ||
tileClipRect.setAttribute('height', squareSize); | ||
tileClipRect.setAttribute('x', col * SQUARE_SIZE); | ||
tileClipRect.setAttribute('y', row * SQUARE_SIZE); | ||
tileClipRect.setAttribute('x', col * squareSize); | ||
tileClipRect.setAttribute('y', row * squareSize); | ||
tileClip.appendChild(tileClipRect); | ||
@@ -208,4 +238,4 @@ svg.appendChild(tileClip); | ||
'url(#tileClipPath' + tileId + ')'); | ||
tileElement.setAttribute('x', (col - left) * SQUARE_SIZE); | ||
tileElement.setAttribute('y', (row - top) * SQUARE_SIZE); | ||
tileElement.setAttribute('x', (col - left) * squareSize); | ||
tileElement.setAttribute('y', (row - top) * squareSize); | ||
svg.appendChild(tileElement); | ||
@@ -212,0 +242,0 @@ |
@@ -29,2 +29,3 @@ /** | ||
const PegmanController = require('./pegmanController'); | ||
const Pegman = require('./pegman'); | ||
const MazeMap = require('./mazeMap'); | ||
@@ -179,2 +180,4 @@ const drawMap = require('./drawMap'); | ||
this.setPegmanD(this.startDirection); | ||
} else { | ||
// TODO: remove all pegmen except the default | ||
} | ||
@@ -395,2 +398,7 @@ this.animationsController.reset(first); | ||
} | ||
addPegman(id, x, y, d) { | ||
const pegman = new Pegman(id, x, y, d); | ||
this.pegmanController.addPegman(pegman); | ||
} | ||
}; |
@@ -128,2 +128,6 @@ const Cell = require('./cell'); | ||
isNeighborhood() { | ||
return false; | ||
} | ||
// Return a value of '0' if the specified square is wall or out of bounds '1' | ||
@@ -130,0 +134,0 @@ // otherwise (empty, obstacle, start, finish). |
@@ -10,2 +10,3 @@ /** | ||
const Planter = require('./planter'); | ||
const Neighborhood = require('./neighborhood'); | ||
@@ -19,3 +20,4 @@ module.exports = { | ||
Planter, | ||
Neighborhood | ||
} | ||
@@ -97,2 +97,6 @@ import {DEFAULT_PEGMAN_ID} from './constants' | ||
module.exports.isNeighborhoodSkin = function isNeighborhoodSkin(skinId) { | ||
return skinId === 'neighborhood'; | ||
} | ||
module.exports.getSubtypeForSkin = function getSubtypeForSkin(skinId) { | ||
@@ -120,2 +124,5 @@ if (module.exports.isFarmerSkin(skinId)) { | ||
} | ||
if (module.exports.isNeighborhoodSkin(skinId)) { | ||
return require('./neighborhood'); | ||
} | ||
@@ -122,0 +129,0 @@ return require('./subtype'); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
533755
61
5204
0