Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@code-dot-org/maze

Package Overview
Dependencies
Maintainers
13
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@code-dot-org/maze - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

src/neighborhood.js

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc