{"size": 1052, "ext": "js", "max_stars_repo_path": "src/QCollisionMap/ColliderManager.js", "max_stars_repo_name": "LunaTechsDev/Luna-QPlugins", "max_stars_repo_stars_event_min_datetime": "2022-03-31T10:04:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T10:04:17.000Z", "max_issues_repo_path": "src/QCollisionMap/ColliderManager.js", "max_issues_repo_name": "LunaTechsDev/Luna-QPlugins", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/QCollisionMap/ColliderManager.js", "max_forks_repo_name": "LunaTechsDev/Luna-QPlugins", "max_forks_repo_forks_event_min_datetime": "2020-10-07T17:26:57.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-30T06:28:15.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 29.2222222222, "max_line_length": 69, "alphanum_fraction": 0.7699619772}
import { _CMFOLDER } from "./constants";

const ColliderManager = QMovement.ColliderManager;

ColliderManager.collisionMap = new Sprite();
ColliderManager.collisionMap.bitmap = new Bitmap();

const Alias_ColliderManager_clear = ColliderManager.clear;
ColliderManager.clear = function () {
  Alias_ColliderManager_clear.call(this);
  this.clearCollisionMap();
  this.container.addChild(this.collisionMap);
};

ColliderManager.setCollisionMap = function (collisionMap) {
  ColliderManager.collisionMap.bitmap = ImageManager.loadBitmap(
    _CMFOLDER,
    collisionMap
  );
};

ColliderManager.clearCollisionMap = function () {
  ColliderManager.collisionMap.bitmap = new Bitmap();
};

const Alias_ColliderManager_update = ColliderManager.update;
ColliderManager.update = function () {
  Alias_ColliderManager_update.call(this);
  this.updateCollisionMap();
};

ColliderManager.updateCollisionMap = function () {
  this.collisionMap.x = -$gameMap.displayX() * $gameMap.tileWidth();
  this.collisionMap.y = -$gameMap.displayY() * $gameMap.tileHeight();
};
