在矩形移相器io中添加图像

时间:2018-07-04 11:46:12

标签: javascript phaser-framework

我想添加那些苹果,以免超出以下形状。这是移相器io中的代码:

rectangle = new Phaser.Rectangle(game.world.centerX - 300, game.world.centerY - 300, 600, 200);
bmd = game.add.bitmapData(game.width, game.height);
bmd.rect(rectangle.x, rectangle.y, rectangle.width, rectangle.height, '#fff')
bmd.addToWorld()

var gm = this;
var w = rectangle.width,
h = rectangle.height, 
x = rectangle.x, 
y = rectangle.y;
height = y - h,
mid = height/3;
img = {'width':0};
var group = game.add.group();
for(var a = 0; a < 10; a++) {
    var imgWidth = rectangle.x + img.width  * a;
    img = this.game.add.image(imgWidth, rectangle.y + mid, 'apple');
    //img.anchor.setTo(0.5);
}

enter image description here

0 个答案:

没有答案