// Screen function screen() { var type, name, description, background, bbackground, width, height, viswidth, visheight, elem this.type="screen" } screen.prototype.create=function() { document.body.style.background=style_bg_img(this.bbackground) this.elem=document.createElement("div") this.elem.style.background=style_bg_img(this.background) this.elem.id="gamebox" this.elem.style.width=(this.viswidth)+"px" this.elem.style.height=(this.visheight)+"px" this.elem.style.marginLeft=(-this.viswidth/2)+"px" this.elem.style.marginTop=(-this.visheight/2)+"px" document.body.appendChild(this.elem) characters_container=document.createElement("div") characters_container.id="characters" this.elem.appendChild(characters_container) } screen.prototype.add=function(obj) { eval(obj.type+"s_container").appendChild(obj.elem) if (obj.type=="character") bring_to_life(obj) } screen.prototype.remove=function() { document.body.style.background="" document.body.removeChild(this.elem) } // Character function character() { var type, name, description, src, width, height, dirs, elem, elems this.type="character" this.dirs=new Array(8) } character.prototype.dir=function(dir) { this.dirs[dir[0]]=new Array() this.dirs[dir[0]][0]=dir[1] for (var i=1;i<4;i++) { this.dirs[dir[0]][i]=new Array() } for (i=2;i