加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
const _Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer; Spriteset_Map.prototype.createLowerLayer = function () { _Spriteset_Map_createLowerLayer.call(this); if (Utils.isNwjs()) { this.createCursor(); } } Spriteset_Map.prototype.createCursor = function () { this._cursorSprite = new Sprite_Cursor(); this._cursorSprite.z = 2; this._tilemap.addChild(this._cursorSprite); } class Sprite_Cursor extends Sprite { initialize() { super.initialize(); this.create(); } create() { const bitmap = new Bitmap(48, 48); const c = "#B22222"; bitmap.fillRect(0, 0, 48, 48, c); bitmap.clearRect(12, 0, 24, 48); bitmap.clearRect(0, 12, 48, 24); bitmap.clearRect(3, 3, 42, 42); this.bitmap = bitmap; } update() { super.update(); const mapX = $gameMap.canvasToMapX(TouchInput.x); const mapY = $gameMap.canvasToMapY(TouchInput.y); const sx = $gameMap.adjustX(mapX) * $gameMap.tileWidth(); const sy = $gameMap.adjustY(mapY) * $gameMap.tileHeight(); this.move(sx, sy); } }
const _Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer;
Spriteset_Map.prototype.createLowerLayer = function () {
_Spriteset_Map_createLowerLayer.call(this);
if (Utils.isNwjs()) {
this.createCursor();
}
}
Spriteset_Map.prototype.createCursor = function () {
this._cursorSprite = new Sprite_Cursor();
this._cursorSprite.z = 2;
this._tilemap.addChild(this._cursorSprite);
}
class Sprite_Cursor extends Sprite {
initialize() {
super.initialize();
this.create();
}
create() {
const bitmap = new Bitmap(48, 48);
const c = "#B22222";
bitmap.fillRect(0, 0, 48, 48, c);
bitmap.clearRect(12, 0, 24, 48);
bitmap.clearRect(0, 12, 48, 24);
bitmap.clearRect(3, 3, 42, 42);
this.bitmap = bitmap;
}
update() {
super.update();
const mapX = $gameMap.canvasToMapX(TouchInput.x);
const mapY = $gameMap.canvasToMapY(TouchInput.y);
const sx = $gameMap.adjustX(mapX) * $gameMap.tileWidth();
const sy = $gameMap.adjustY(mapY) * $gameMap.tileHeight();
this.move(sx, sy);
}
}
|