bitmapでアプリが強制終了してしまう
Posted: 2023年10月24日(火) 15:28
コード: 全て選択
var _Spriteset_Base_createUpperLayer = Spriteset_Base.prototype.createUpperLayer;
Spriteset_Base.prototype.createUpperLayer = function() {
_Spriteset_Base_createUpperLayer.apply(this, arguments);
if (this instanceof Spriteset_Map) {
this.createDrawSprite();
}
};
Spriteset_Map.prototype.createDrawSprite = function() {
for(var x = 0; x < $dataMap.width; x++){
for(var y = 0; y < $dataMap.height; y++){
var sprite = new Sprite();
var color = 'rgba(255, 255, 255, 0.5)';
sprite.bitmap = this.makeDrawBitmap(x, y, color);
this.addChild(sprite);
}
}
};
Spriteset_Map.prototype.makeDrawBitmap = function(x, y, color) {
var bitmap = new Bitmap(Graphics.boxWidth / 2, Graphics.boxHeight / 2);
switch(true){
case $gameMap.isPassable(x, y, 2):
case $gameMap.isPassable(x, y, 4):
case $gameMap.isPassable(x, y, 6):
case $gameMap.isPassable(x, y, 8):
bitmap.fillRect(x * 5, y * 5, 5, 5, color);
return bitmap;
}
};