Skip to content

Instantly share code, notes, and snippets.

@dharma017
Created September 14, 2015 10:59
Show Gist options
  • Select an option

  • Save dharma017/dce409abbcda6aef1949 to your computer and use it in GitHub Desktop.

Select an option

Save dharma017/dce409abbcda6aef1949 to your computer and use it in GitHub Desktop.
Fill hitarea with rectangular graphics in pixi js
for (var i = 0; i < 4; i++) {
var x1 = this.dropParams.position[i * 2],
y1 = this.dropParams.position[i * 2 + 1],
x2 = this.dropParams.position[i * 2] + this.dropParams.w,
y2 = this.dropParams.position[i * 2 + 1] + this.dropParams.h;
var otherObject = new PIXI.DisplayObjectContainer();
var graphics = new PIXI.Graphics();
graphics.beginFill(0xFFFFFF, 0.5);
graphics.lineStyle(1, 0x000000, 0.5);
graphics.drawRect(x1, y1, this.dropParams.w, this.dropParams.h);
otherObject.addChild(graphics);
this.introContainer.addChild(otherObject);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment