function style_bg_img(background) { var cssurl if (background.indexOf(".")!=-1) cssurl=["url(",")"] else cssurl=["",""] return cssurl[0]+background+cssurl[1] } function create(scr) { scr.create() link(scr) } function remove(obj) { if (obj.type="character") take_life(obj) obj.remove() delete obj } function getkeycode(e) { var keycode if (window.event) keycode=window.event.keyCode else if (e) keycode=e.which else keycode=0 return keycode } function START_systems() { key_up=false key_right=false key_down=false key_left=false key_shift=false key_control=false key_order=new Array() for (var i=0;i<4;i++) { key_order[i]=0 } direction=7 character_state=1 document.onkeydown=keydown document.onkeyup=keyup characters=new Array() row_num=new Array() col_num=new Array() col_length=new Array() define_pixel_movement(3,5) frame_showing_speed=150 character_movement_speed=50 frame_showing() character_movement() //setInterval(debugging,100) } function debugging() { document.title=direction+" | "+col_length[0]+" | "+col_num[0]+" | "+character_state } function define_pixel_movement(walk,run) { pixel_movement=[0,walk,run] diagonal_pixel_movement=[0,Math.sqrt(walk*walk/2),Math.sqrt(run*run/2)] } function show_frame(cha_num,row,col) { characters[cha_num].elem.style.backgroundPosition="-"+(col*(cha.width+1)+1)+"px -"+(cha.dirs[row][0]*(cha.height+1)+1)+"px" } function frame_showing() { for (var i=0;i-1) characters[i].posY=y break; case 2: y=characters[i].posY-dia_pixmove x=characters[i].posX+dia_pixmove if (y>-1) characters[i].posY=y if (x-1) characters[i].posX=x break; case 7: x=characters[i].posX-pixmove if (x>-1) characters[i].posX=x break; case 8: x=characters[i].posX-dia_pixmove y=characters[i].posY-dia_pixmove if (x>-1) characters[i].posX=x if (y>-1) characters[i].posY=y break; } characters[i].elem.style.left=characters[i].posX+"px" characters[i].elem.style.top=characters[i].posY+"px" } setTimeout(character_movement,character_movement_speed) } function get_character_state() { if (key_order[0]==0) character_state=1 else if (!key_shift && key_order[0]>0) character_state=2 else if (key_shift && key_order[0]>0) character_state=3 } function get_row_num() { for (var i=0;i0 && (keycode==38 || keycode==39 || keycode==40 || keycode==37)) find_direction() if (keycode==38 || keycode==39 || keycode==40 || keycode==37 || keycode==16) get_col_length() } function link(scr) { current_screen=scr } function give_life(cha) { col_num[characters.length]=0 characters[characters.length]=cha get_col_length() } function take_life(cha) { for (var i=0;i