Removed module that should not have been deleted
This commit is contained in:
parent
57da262827
commit
1452b28732
@ -6,6 +6,7 @@ var AnimManager = require("./AnimManager.js"),
|
|||||||
math = require("./utilities/math.js"),
|
math = require("./utilities/math.js"),
|
||||||
entity = require("./utilities/entity.js"),
|
entity = require("./utilities/entity.js"),
|
||||||
wallslide = require("./movement/wallslide.js"),
|
wallslide = require("./movement/wallslide.js"),
|
||||||
|
deadInTracks = require("./movement/deadInTracks.js"),
|
||||||
Sound = require("./sound/Sound.js"),
|
Sound = require("./sound/Sound.js"),
|
||||||
Rect = require("./Rect.js"),
|
Rect = require("./Rect.js"),
|
||||||
KeyControls = require("./controls/KeyControls.js"),
|
KeyControls = require("./controls/KeyControls.js"),
|
||||||
@ -29,6 +30,7 @@ module.exports = {
|
|||||||
math,
|
math,
|
||||||
entity,
|
entity,
|
||||||
wallslide,
|
wallslide,
|
||||||
|
deadInTracks,
|
||||||
Sound,
|
Sound,
|
||||||
Rect,
|
Rect,
|
||||||
KeyControls,
|
KeyControls,
|
||||||
|
16
lib/movement/deadInTracks.js
Normal file
16
lib/movement/deadInTracks.js
Normal 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
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user