Code:
// global namespace
var STATES = STATES || {};
STATES.NormalState = function (x,y) { return {
type:"generic state",
xPoint:x,
yPoint:y,
color:"blue"
};
}
STATES.NormalState.prototype.draw = function(context){
context.beginPath();
context.arc(this.xPoint,this.yPoint,10,0,Math.PI*2,true); // circle
context.fillStyle=this.color;
context.fill();
}
this isn't adding draw to the STATES.NormalState object when created with new how to add this shared method ?