Removed module that should not have been deleted

This commit is contained in:
Arne van Iterson 2020-04-12 14:03:06 +02:00
parent 57da262827
commit 1452b28732
2 changed files with 18 additions and 0 deletions

View File

@ -6,6 +6,7 @@ var AnimManager = require("./AnimManager.js"),
math = require("./utilities/math.js"),
entity = require("./utilities/entity.js"),
wallslide = require("./movement/wallslide.js"),
deadInTracks = require("./movement/deadInTracks.js"),
Sound = require("./sound/Sound.js"),
Rect = require("./Rect.js"),
KeyControls = require("./controls/KeyControls.js"),
@ -29,6 +30,7 @@ module.exports = {
math,
entity,
wallslide,
deadInTracks,
Sound,
Rect,
KeyControls,

View File

@ -0,0 +1,16 @@
const entity = require("../utilities/entity");
function deadInTracks(ent, map, x = 0, y = 0) {
const bounds = entity.bounds(ent);
const tiles = map.tilesAtCorners(bounds, x, y);
const walks = tiles.map(t => t && t.frame.walkable);
const blocked = walks.some(w => !w);
if (blocked) {
x = 0,
y = 0;
}
return { x, y };
}
module.exports = {
deadInTracks
};