1 /**
  2  * Abstract game item
  3  * @param {Number} w
  4  * @param {Number} h
  5  * @param {Number} x
  6  * @param {Number} y
  7  * @constructor
  8  */
  9 function CP_Item(w, h, x, y) {
 10 	this.set(w, h, x, y);
 11 }
 12 
 13 /**
 14  * Set dimensions and coordinates
 15  * @param {Number} w
 16  * @param {Number} h
 17  * @param {Number} x
 18  * @param {Number} y
 19  */
 20 CP_Item.prototype.set = function(w, h, x, y) {
 21 	this.w = w || 0;
 22 	this.h = h || 0;
 23 	this.x = x || 0;
 24 	this.y = y || 0;
 25 };
 26 
 27 /**
 28  * Get/Set the origo x coordinate
 29  * @param {Number} value
 30  * @returns {Number} 
 31  */
 32 CP_Item.prototype.ox = function(value) {
 33 	if (value) {
 34 		this.x = value - (this.w / 2);
 35 	} else {
 36 		value = this.x + (this.w / 2); 
 37 	}
 38 	return value;
 39 };
 40 
 41 /**
 42  * Get/Set the origo y coordinate
 43  * @param {Number} value
 44  * @returns {Number} 
 45  */
 46 CP_Item.prototype.oy = function(value) {
 47 	if (value) {
 48 		this.y = value - (this.h / 2);
 49 	} else {
 50 		value = this.y + (this.h / 2); 
 51 	}
 52 	return value;
 53 };
 54 
 55 /**
 56  * Clear the item
 57  * @param ctx
 58  */
 59 CP_Item.prototype.clear = function(ctx) {
 60 	ctx.clearRect(this.x, this.y, this.w, this.h);
 61 };
 62 
 63 /**
 64  * Abstract draw function
 65  * @param ctx
 66  */
 67 CP_Item.prototype.paint = function(ctx) {};
 68 
 69 /**
 70  * Abstract animation thread
 71  */
 72 CP_Item.prototype.run = function() {};
 73 
 74