Manually setting object's position or have the object do it all?
- by N. Lucas
I'm stuck thinking about the best way to go about setting a line segment's position, I have a class Line(length, angle, previous) being called from a class Polygon.. Right now I have:
public function Line(length:Number, angle:Number, previous:Line = null) {
if (previous != null) {
this.x = previous.end.x;
this.y = previous.end.y;
}
/**/
}
Now, is this the best practice or should I be doing:
Polygon.addLine(length:Number, angle:Number):void {
var previous = _line[_line.length - 1]; // Array containing all Lines
var line:Line = new Line(length, angle, previous);
line.x = previous.end.x;
line.y = previous.end.y;
/**/
}