var Bb = function() { this.x = 300; this.y = 300; } Bb.prototype.drowBb = function(){ this.x = rnd(-1,1)+this.x; this.y = rnd(-1,1)+this.y; ctx.drawImage(obj1, this.x, this.y); }