home *** CD-ROM | disk | FTP | other *** search
/ ring.yamanashi.ac.jp/pub/pc/freem/action/ / action.zip / TQAP.zip / Usr / Enemy.tonyu < prev    next >
Text File  |  2007-06-09  |  17KB  |  761 lines

  1. extends DxChar;
  2.  
  3. x=trunc(x/32)*32+16;
  4. y=trunc(y/32)*32+16;
  5. vx=0;
  6. vy=0;
  7. zOrder=2;
  8. before=0;
  9.  
  10. //âüâCâô---------------------------------------------------------------
  11.  
  12. for (jiki in $chars){
  13.   if (jiki is Mychar) break;
  14. }
  15.  
  16. wait(1);
  17.  
  18. if (p==$pat_enemy+6) x_trap();
  19. if (p==$pat_enemy+7) y_trap();
  20. if (p==$pat_enemy+8) rotate_trap();
  21. if (p==$pat_enemy+9) refrection();
  22. if (p==$pat_enemy+12) hopping();
  23. if (p==$pat_enemy+15) ghost();
  24. if (p==$pat_enemy+18) wolf();
  25. if (p==$pat_enemy+21) bubels();
  26. if (p==$pat_block+6) fall_brick();
  27.  
  28.  
  29.  
  30. //ôGìsô«âpâ^ü[âôÉ▌ÆΦü@--------------------------------------------------------
  31.  
  32. function x_trap(){
  33.   
  34.   var move01,move02,move03,move04,move05;
  35.   var anim01,anim02,anim03,anim04,anim05;
  36.   
  37.   wsp=2;
  38.   
  39.   while(1){
  40.     
  41.     while(1) {if (jiki.pause==0) break;update();}
  42.     WallHit_chk();
  43.     atarihantei();
  44.     block_sound();
  45.     magma();
  46.     
  47.     move01=(wX!=0);
  48.     move02=(abs(jiki.y-y)<15 && (jiki.x-x)>0 && vx==0 && Block_exist_x()==0 && (jiki.isout()!=1 || jiki.opening==1));
  49.     move03=(abs(jiki.y-y)<15 && (jiki.x-x)<0 && vx==0 && Block_exist_x()==0 && (jiki.isout()!=1 || jiki.opening==1));
  50.     
  51.     anim01=(vx==0);
  52.     anim02=(vx< 0);
  53.     anim03=(vx> 0);
  54.     
  55.     if (move01==1) vx=0;
  56.     if (move02==1) vx= wsp;
  57.     if (move03==1) vx=-wsp;
  58.     
  59.     if (anim01==1) angle= 0;      
  60.     if (anim02==1) {
  61.       if ($map.getAt(x,y)==$pat_block+5) angle-=wsp*3;
  62.       else angle-=wsp*5;
  63.     }
  64.     
  65.     if (anim03==1) {
  66.       if ($map.getAt(x,y)==$pat_block+5) angle+=wsp*3;
  67.       else angle+=wsp*5;
  68.     }
  69.     
  70.     x=x+vx;
  71.     update();
  72.   }
  73. }
  74.  
  75. function y_trap(){
  76.   
  77.   var move01,move02,move03,move04,move05;
  78.   var anim01,anim02,anim03,anim04,anim05;
  79.   
  80.   wsp=2;
  81.   
  82.   while(1){
  83.     
  84.     while(1) {if (jiki.pause==0) break;update();}
  85.     
  86.     WallHit_chk();
  87.     atarihantei();
  88.     block_sound();
  89.     magma();
  90.     
  91.     move01=(wY!=0);
  92.     move02=(abs(jiki.x-x)<15 && (jiki.y-y)>0 && vy==0 && Block_exist_y()==0 && (jiki.isout()!=1 || jiki.opening==1));
  93.     move03=(abs(jiki.x-x)<15 && (jiki.y-y)<0 && vy==0 && Block_exist_y()==0 && (jiki.isout()!=1 || jiki.opening==1));
  94.     
  95.     anim01=(vy==0);
  96.     anim02=(vy< 0);
  97.     anim03=(vy> 0);
  98.     
  99.     if (move01==1) vy=0;
  100.     if (move02==1) vy= wsp;
  101.     if (move03==1) vy=-wsp;
  102.     
  103.     if (anim01==1) angle= 0;
  104.  
  105.     if (anim02==1) {
  106.       if ($map.getAt(x,y)==$pat_block+5) angle-=wsp*3;
  107.       else angle-=wsp*5;
  108.     }
  109.     
  110.     if (anim03==1){
  111.       if ($map.getAt(x,y)==$pat_block+5) angle+=wsp*3;
  112.       else angle+=wsp*5;
  113.     }
  114.     
  115.     y=y+vy;
  116.     update();
  117.   }
  118. }
  119.  
  120. function rotate_trap(){
  121.   
  122.   rotate;
  123.   wsp=2;
  124.   wX=0;
  125.   wY=0;
  126.   if(isblock($map.getAt(x-24,y))) wX=-1;
  127.   if(isblock($map.getAt(x+24,y))) wX= 1;
  128.   if(isblock($map.getAt(x,y-24))) wY=-1;
  129.   if(isblock($map.getAt(x,y+24))) wY= 1;
  130.  
  131.   if (wY==1) y+=3;
  132.   if (wX==1) x+=3;
  133.   if (wY==-1) y-=3;
  134.   if (wX==-1) x-=3;
  135.   
  136.   while(1){
  137.     
  138.     while(1) {if (jiki.pause==0) break;update();}
  139.     
  140.     if (rotate==0){
  141.       
  142.       if (wX== 1 && wY== 0) vy= wsp;
  143.       if (wX== 1 && wY== 1) vx=-wsp;
  144.       if (wX== 0 && wY== 1) vx=-wsp;
  145.       if (wX==-1 && wY== 1) vy=-wsp;
  146.       if (wX==-1 && wY== 0) vy=-wsp;
  147.       if (wX==-1 && wY==-1) vx= wsp;
  148.       if (wX== 0 && wY==-1) vx= wsp;
  149.       if (wX== 1 && wY==-1) vy= wsp;
  150.       if (wX== 0 && wY== 0) {
  151.         if(isblock($map.getAt(x+14,y+14))) vy= wsp;
  152.         if(isblock($map.getAt(x+14,y-14))) vx= wsp;
  153.         if(isblock($map.getAt(x-14,y-14))) vy=-wsp;
  154.         if(isblock($map.getAt(x-14,y+14))) vx=-wsp;
  155.       }
  156.       if ($map.getAt(x,y)==$pat_block+5) angle-=wsp*3;
  157.       else angle-=wsp*5;
  158.     }
  159.     
  160.     if (rotate==1){
  161.       if (wX== 1 && wY== 0) vy=-wsp;
  162.       if (wX== 1 && wY== 1) vy=-wsp;
  163.       if (wX== 0 && wY== 1) vx= wsp;
  164.       if (wX==-1 && wY== 1) vx= wsp;
  165.       if (wX==-1 && wY== 0) vy= wsp;
  166.       if (wX==-1 && wY==-1) vy= wsp;
  167.       if (wX== 0 && wY==-1) vx=-wsp;
  168.       if (wX== 1 && wY==-1) vx=-wsp;
  169.       if (wX== 0 && wY== 0) {
  170.         if(isblock($map.getAt(x+14,y-14))) vy=-wsp;
  171.         if(isblock($map.getAt(x+14,y+14))) vx= wsp;
  172.         if(isblock($map.getAt(x-14,y+14))) vy= wsp;
  173.         if(isblock($map.getAt(x-14,y-14))) vx=-wsp;
  174.         
  175.       }
  176.       if ($map.getAt(x,y)==$pat_block+5) angle+=wsp*3;
  177.       else angle+=wsp*5;
  178.     }
  179.     
  180.     x=x+vx;
  181.     y=y+vy;
  182.     
  183.     update();
  184.     
  185.     if (abs(angle)>=360) angle=0;
  186.     vx=0;
  187.     vy=0;
  188.     WallHit_chk2();
  189.     atarihantei();
  190.     block_sound();
  191.   } 
  192. }
  193.  
  194. function hopping(){
  195.   
  196.   var move01,move02,move03,move04,move05;
  197.   var anim01,anim02,anim03,anim04,anim05;
  198.   var anim  ;
  199.   
  200.   p=$pat_enemy+3;
  201.   wsp=1;
  202.   vx=wsp;
  203.   anim=newAnimation();
  204.   
  205.   anim.swing($pat_enemy+12,$pat_enemy+14,8);
  206.   
  207.   while(1){
  208.     
  209.     while(1) {if (jiki.pause==0) break;update();}
  210.     
  211.     WallHit_chk();
  212.     atarihantei();
  213.     magma();
  214.     
  215.     move01=(wY== 1);
  216.     move02=(wY== 0);
  217.     move03=(wX== 1);
  218.     move04=(wX==-1);
  219.     move05=(wY==-1);
  220.     
  221.     anim01=(vx==0);
  222.     anim02=(vx< 0);
  223.     anim03=(vx> 0);
  224.     
  225.     if (move01==1) vy=-6;
  226.     if (move02==1) vy+=0.2;
  227.     if (move03==1) vx=-wsp;
  228.     if (move04==1) vx= wsp;
  229.     if (move05==1) vy=0.3;
  230.     
  231.     x=x+vx;
  232.     y=y+vy;
  233.     update();
  234.   }
  235. }
  236.  
  237. function ghost(){
  238.   
  239.   var move01,move02,move03,move04,move05;
  240.   var anim01,anim02,anim03,anim04,anim05;
  241.   var anim,i,angle;
  242.   
  243.   anim=newAnimation();
  244.   anim.swing($pat_enemy+15,$pat_enemy+17,8);
  245.   
  246.   while(1){
  247.     
  248.     while(1) {if (jiki.pause==0) break;update();}
  249.     
  250.     atarihantei();
  251.     
  252.     angle=angle(jiki.x-x,jiki.y-y);
  253.     vx=0.3*cos(angle);
  254.     vy=0.3*sin(angle);
  255.     
  256.     if ($map.getAt(x,y)==$pat_block+7){
  257.       vx=0;
  258.       vy=0;
  259.       if (before==0) {
  260.         $mplayer.play($se_shoot03);
  261.         before=1;
  262.       }
  263.     }
  264.     else before=0;
  265.     
  266.     x+=vx;
  267.     y+=vy;
  268.     
  269.     update();
  270.   } 
  271. }
  272.  
  273. function refrection(){
  274.   
  275.   wsp=1;
  276.   vx= wsp;
  277.   vy=-wsp;
  278.   anim=newAnimation();
  279.   //hit=0;
  280.   size=10;
  281.   
  282.   while(1){
  283.     
  284.     while(1) {if (jiki.pause==0) break;update();}
  285.     
  286.     WallHit_chk2();
  287.     atarihantei();
  288.     block_sound();
  289.     
  290.     if (wX==1 || wX==-1) {vx=-vx;x+=vx;}
  291.     if (wY==1 || wY==-1) {vy=-vy;y+=vy;}
  292.     
  293.     while(1){
  294.       stop=0;
  295.       if(isblock($map.getAt(x+size,y+size))) stop=1;
  296.       if(isblock($map.getAt(x+size,y-size))) stop=1;
  297.       if(isblock($map.getAt(x-size,y+size))) stop=1;
  298.       if(isblock($map.getAt(x-size,y-size))) stop=1;
  299.       if (stop==0) break;
  300.       update();
  301.     }
  302.     
  303.     anim.swing($pat_enemy+9,$pat_enemy+11,8);
  304.     if (vx<0) f=-1;
  305.     if (vx>0) f= 1;
  306.     
  307.     if (wX!=2){
  308.       x+=vx;
  309.       y+=vy;
  310.     }
  311.     update();
  312.   }
  313. }
  314.  
  315. function wolf(){
  316.   
  317.   wsp=1;
  318.   f=1;
  319.   anim=newAnimation();
  320.   touchlever=0;
  321.   
  322.   while(1){
  323.     
  324.     WallHit_chk();
  325.     Ladder();
  326.     block_sound();
  327.     magma();
  328.     
  329.     while(1) {if (jiki.pause==0) break;update();}
  330.     
  331.     //anim.swing($pat_enemy+18,$pat_enemy+20,12);
  332.     
  333.     //âîâoü[é╔ÉGéΩé╜éτâXâCâbâ`âIâô
  334.     
  335.     for (e in $chars){
  336.       if (e is Lever && crashTo(e) && touchlever==0) {        
  337.         if (e.p==$pat_lever+6){
  338.           e.p=$pat_lever+8;
  339.           e.switchSPCtoNOG();
  340.         }
  341.         else if (e.p==$pat_lever+8){
  342.           e.p=$pat_lever+6;
  343.           e.switchSPCtoNOG();
  344.         }
  345.         else if (e.p==$pat_lever+0){
  346.           e.p=$pat_lever+2;
  347.           e.switchBBRtoHBR();
  348.         }
  349.         else if (e.p==$pat_lever+2){
  350.           e.p=$pat_lever+0;
  351.           e.switchBBRtoHBR();
  352.         }
  353.         else if (e.p==$pat_lever+9){
  354.           e.p=$pat_lever+11;
  355.           e.Upsidedown();
  356.         }
  357.         else if (e.p==$pat_lever+11){
  358.           e.p=$pat_lever+9;
  359.           e.Upsidedown();
  360.         }
  361.         touchlever=1;
  362.         break;
  363.       }
  364.       if (e is Lever && !crashTo(e) && touchlever==1) touchlever=0;
  365.     }
  366.  
  367.     while(wX==2){
  368.       WallHit_chk();
  369.       Ladder();
  370.       atarihantei();
  371.       update();
  372.     }
  373.     
  374.     if (wY== 0 || ld==1 || wY==-1)  {
  375.       if ($map.getAt(x,y)==$pat_block+5) vy+=0.04;
  376.       else vy+=0.4;
  377.     }
  378.     
  379.     if (wY>= 1 || ld==2) {vy=0;y=trunc(y/32)*32+16;}
  380.     
  381.     ashimoto1=isback($map.getAt(x+8,y+17)) || ($map.getAt(x+8,y+17)==$pat_block+5);
  382.     ashimoto2=isback($map.getAt(x-8,y+17)) || ($map.getAt(x-8,y+17)==$pat_block+5);
  383.     
  384.     if (wX==1 || wX==-1){
  385.       
  386.       for(i=0;i<50;i++){
  387.         atarihantei();
  388.         WallHit_chk();
  389.         //if (wY==0 && ld!=2) break;
  390.         while(1) {if (jiki.pause==0) break;update();}
  391.         anim.pause();
  392.         update();
  393.       }
  394.       f=-f;
  395.  
  396.       if ($map.getAt(x,y)==$pat_block+5) anim.swing($pat_enemy+18,$pat_enemy+20,24);
  397.       else anim.swing($pat_enemy+18,$pat_enemy+20,12);
  398.       
  399.     }
  400.     
  401.     if (wY==1 || ld==2 || wY==2 || (wX!=0 && ld==1)) vx=f*wsp;
  402.     if (ld==1) vy=0;
  403.     if (wY==0 && ld==0) {
  404.       atarihantei();
  405.       vx=0;
  406.       anim.pause();
  407.     }
  408.     
  409.     atarihantei();
  410.     
  411.     if (wY!=0){
  412.       
  413.       if ($map.getAt(x,y)==$pat_block+5) anim.swing($pat_enemy+18,$pat_enemy+20,24);
  414.       else anim.swing($pat_enemy+18,$pat_enemy+20,12);
  415.  
  416.     }
  417.  
  418.     if (vy>9) vy=9;
  419.     x+=vx;
  420.     y+=vy;
  421.     update();
  422.   }
  423. }
  424.  
  425. function bubels(){
  426.   
  427.   wsp=1;
  428.   f=1;
  429.   anim=newAnimation();
  430.   
  431.   while(1){
  432.     
  433.     WallHit_chk();
  434.     Ladder();
  435.     block_sound();
  436.     magma();
  437.     
  438.     while(1) {if (jiki.pause==0) break;update();}
  439.     
  440.     while(wX==2){
  441.       WallHit_chk();
  442.       Ladder();
  443.       atarihantei();
  444.       update();
  445.     }
  446.     
  447.     if (wY== 0 || ld==1 || wY==-1)  {
  448.       if ($map.getAt(x,y)==$pat_block+5) vy+=0.04;
  449.       else vy+=0.4;
  450.     }
  451.     
  452.     if (wY>= 1 || ld==2) {vy=0;y=trunc(y/32)*32+16;}
  453.     
  454.     //ashimoto1=isback($map.getAt(x+8,y+17)) || ($map.getAt(x+8,y+17)==$pat_block+5);
  455.     //ashimoto2=isback($map.getAt(x-8,y+17)) || ($map.getAt(x-8,y+17)==$pat_block+5);
  456.     
  457.     ashimoto1=isback($map.getAt(x+1,y+17)) || ($map.getAt(x+8,y+17)==$pat_block+5);
  458.     ashimoto2=isback($map.getAt(x-1,y+17)) || ($map.getAt(x-8,y+17)==$pat_block+5);
  459.     
  460.     if (wX==1 || wX==-1 || ((ashimoto1==1 || ashimoto2==1) && (wY==1 || ld==2 || wY==2))){
  461.       
  462.       if (ashimoto1==1 || ashimoto2==1) appear(new Enemy(x+f*32,y,$pat_block+6));
  463.       
  464.       for(i=0;i<50;i++){
  465.         atarihantei();
  466.         WallHit_chk();
  467.         if (wY==0 && ld!=2) {rakka=1;break;}
  468.         while(1) {if (jiki.pause==0) break;update();}
  469.         anim.pause();
  470.         update();
  471.       }
  472.       f=-f;
  473.       anim.swing($pat_enemy+21,$pat_enemy+23,12);
  474.     }
  475.     
  476.     if(rakka==1){
  477.       x+=f*3;
  478.       rakka=0;
  479.     }
  480.     
  481.     if (ashimoto1==1 && ashimoto2==1 && wY==1) x=trunc(x/32)*32+16;
  482.     
  483.     if (wY==1 || ld==2 || wY==2) vx=f*wsp;
  484.     
  485.     if (wX==2 && ($map.getAt(x,y)!=$pat_block+7)) x=trunc(x/32)*32+16;
  486.     
  487.     if (wY==0 && ld!=2) {
  488.       atarihantei();
  489.       vx=0;
  490.       anim.pause();
  491.     }
  492.     
  493.     if ($map.getAt(x,y)==$pat_block+5) anim.swing($pat_enemy+21,$pat_enemy+23,24);
  494.     else anim.swing($pat_enemy+21,$pat_enemy+23,12);
  495.     
  496.     if (vy>9) vy=9;
  497.     x+=vx;
  498.     y+=vy;
  499.     atarihantei();
  500.     update();
  501.   }
  502. }
  503.  
  504. function fall_brick(){
  505.   
  506.   $mplayer.play($se_swing27);
  507.   
  508.   while(1){
  509.     
  510.     while(1) {if (jiki.pause==0) break;update();}
  511.     
  512.     WallHit_chk();
  513.     Ladder();
  514.     p=$pat_block+6;
  515.     if ($map.getAt(x,y+vy)==$pat_block+1) die();
  516.     
  517.     if (wY==0 || wY==-1) {
  518.       if ($map.getAt(x,y+vy)==$pat_block+5) vy+=0.08;
  519.       else vy+=0.4;
  520.     }
  521.     
  522.     if (wY==1) {
  523.       y=trunc(y/32)*32+16;
  524.       $map.set(x/32,y/32,$pat_block+6);
  525.       $mplayer.play($se_hit52);
  526.       die();
  527.     }
  528.     
  529.     atarihantei();
  530.     if (vy>9) vy=9;
  531.     x+=vx;
  532.     y+=vy;
  533.     update();
  534.   }
  535. }
  536.  
  537.  
  538. //ö╗ÆΦâüâ\âbâh---------------------------------------------------------------
  539.  
  540. function WallHit_chk(){
  541.   
  542.   //ì╢é╠ò╟é╔É┌é╡é─éóéΘü@ü@üFwX=-1ü@ëEé╠ò╟é╔É┌é╡é─éóéΘü@ü@ü@ü@üFwX= 1
  543.   //ì╢ëEé╞éαò╟é╔É┌é╡é─é╚éóüFwX= 0
  544.   //Åπé╠ò╟é╔É┌é╡é─éóéΘü@ü@üFwY=-1ü@ë║é╠ò╟é╔É┌é╡é─éóéΘü@ü@ü@ü@üFwY= 1
  545.   //Åπë║é╞éαò╟é╔É┌é╡é─é╚éóüFwY= 0ü@Åπë║é╠ò╟é╔ô»Ä₧é╔É┌é╡é─éóéΘüFwY= 2
  546.   
  547.   var left1  ,left2  ,right1 ,right2 ;
  548.   var up1    ,up2    ,down1  ,down2  ;
  549.   var center1,center2,center3        ;
  550.   
  551.   left1  =$map.getAt(x-8+vx,y-12);
  552.   left2  =$map.getAt(x-8+vx,y+12);
  553.   right1 =$map.getAt(x+8+vx,y-12);
  554.   right2 =$map.getAt(x+8+vx,y+12);
  555.   up1    =$map.getAt(x-8,y-17   );
  556.   up2    =$map.getAt(x+8,y-17   );
  557.   down1  =$map.getAt(x-8,y+16+vy);
  558.   down2  =$map.getAt(x+8,y+16+vy);
  559.   center1=$map.getAt(x  ,y      );
  560.   center2=$map.getAt(x+8,y      );
  561.   center3=$map.getAt(x-8,y      );
  562.   
  563.   wX=0;wY=0;
  564.   //isblock(left1);
  565.   
  566.   //ì╢
  567.   if(isblock(left1  )) wX=-1;
  568.   if(isblock(left2  )) wX=-1;
  569.   //ëE
  570.   if(isblock(right1 ) && wX==0) wX=1;
  571.   if(isblock(right2 ) && wX==0) wX=1;
  572.   //Åπ
  573.   if(isblock(up1    )) wY=-1;
  574.   if(isblock(up2    )) wY=-1;
  575.   //ë║
  576.   if(isblock(down1  ) && wY== 0) wY=1;
  577.   if(isblock(down1  ) && wY==-1) wY=2;
  578.   if(isblock(down2  ) && wY== 0) wY=1;
  579.   if(isblock(down2  ) && wY==-1) wY=2;
  580.   
  581.   //Æåë¢
  582.   if(isblock(center1)) wX=2;
  583.   if(isblock(center2)) wX=2;
  584.   if(isblock(center3)) wX=2;
  585.   
  586. }
  587.  
  588. function WallHit_chk2(){
  589.   
  590.   var up1,down1,right1,left1,center1;
  591.   var up2,down2,right2,left2,center2;
  592.   var up3,down3,right3,left3,center3;
  593.   var m1,m2;
  594.   
  595.   m1=10;
  596.   m2=12;
  597.   wX=0;wY=0;
  598.   
  599.   up1   =$map.getAt(x+m1,y-m2);
  600.   up2   =$map.getAt(x-m1,y-m2);
  601.   up3   =$map.getAt(x   ,y-m2);
  602.   
  603.   down1 =$map.getAt(x+m1,y+m2);
  604.   down2 =$map.getAt(x-m1,y+m2);
  605.   down3 =$map.getAt(x   ,y+m2);
  606.   
  607.   left1 =$map.getAt(x-m2,y+m1);
  608.   left2 =$map.getAt(x-m2,y-m1);
  609.   left3 =$map.getAt(x-m2,y   );
  610.   
  611.   right1=$map.getAt(x+m2,y+m1);
  612.   right2=$map.getAt(x+m2,y-m1);
  613.   right3=$map.getAt(x+m2,y   );
  614.   
  615.   center1=$map.getAt(x  ,y      );
  616.   center2=$map.getAt(x+8,y      );
  617.   center3=$map.getAt(x-8,y      );
  618.   
  619.   if(isblock(left1 )) wX=-1;
  620.   if(isblock(left2 )) wX=-1;
  621.   if(isblock(left3 )) wX=-1;
  622.   
  623.   if(isblock(right1)) wX= 1;
  624.   if(isblock(right2)) wX= 1;
  625.   if(isblock(right3)) wX= 1;
  626.   
  627.   if(isblock(up1   )) wY=-1;
  628.   if(isblock(up2   )) wY=-1;
  629.   if(isblock(up3   )) wY=-1;
  630.   
  631.   if(isblock(down1 )) wY= 1;
  632.   if(isblock(down2 )) wY= 1;
  633.   if(isblock(down3 )) wY= 1;
  634.   
  635.   if(isblock(center1)) wX=2;
  636.   if(isblock(center2)) wX=2;
  637.   if(isblock(center3)) wX=2;
  638. }
  639.  
  640. function Ladder(){
  641.   ld=0;
  642.   if($map.getAt(x,y      )==$pat_block+12) ld=1;
  643.   if($map.getAt(x,y+15   )==$pat_block+12) ld=1;
  644.   if($map.getAt(x,y+16+vy)==$pat_block+12 && ld==0) ld=2;
  645.   if($map.getAt(x+10+vx,y+16+vy)==$pat_block+12 && ld==0) ld=2;
  646.   if($map.getAt(x-10-vx,y+16+vy)==$pat_block+12 && ld==0) ld=2;
  647.   
  648. }
  649.  
  650. function atarihantei(){  
  651.   
  652.   if (crashTo(jiki)) jiki.enemytouch=1;
  653.   
  654. }
  655.  
  656.  
  657.  
  658. function Block_exist_x(){
  659.   
  660.   var x1,y1,obj_x;
  661.   var i,count;
  662.   
  663.   x1=x;
  664.   y1=y;
  665.   obj_x=jiki.x;
  666.   count=0;
  667.   
  668.   if (x1<obj_x){
  669.     for (i=x1;i<obj_x;i+=32){
  670.       if (isblock($map.getAt(i,y1))==1) count++;
  671.     }
  672.   }
  673.   if (x1>obj_x){
  674.     for (i=x1;i>obj_x;i-=32){
  675.       if (isblock($map.getAt(i,y1))==1) count++;
  676.     }
  677.   }
  678.   return count;
  679. }
  680.  
  681. function Block_exist_y(){
  682.   
  683.   var x1,y1,obj_y;
  684.   var i,count;
  685.   
  686.   x1=x;
  687.   y1=y;
  688.   obj_y=jiki.y;
  689.   count=0;
  690.   
  691.   if (y1<obj_y){
  692.     for (i=y1;i<obj_y;i+=32){
  693.       if (isblock($map.getAt(x1,i))==1) count++;
  694.     }
  695.   }
  696.   if (y1>obj_y){
  697.     for (i=y1;i>obj_y;i-=32){
  698.       if (isblock($map.getAt(x1,i))==1) count++;
  699.     }
  700.   }
  701.   return count;
  702. }
  703.  
  704. function isblock(tile){
  705.   
  706.   var tile_bk1,tile_bk2;
  707.   var value;
  708.   
  709.   tile_bk1=$pat_block+6;
  710.   tile_bk2=$pat_block+11;
  711.   
  712.   value=(tile>=tile_bk1 && tile<=tile_bk2);
  713.   return value;
  714. }
  715.   
  716. function isback(tile){
  717.   
  718.   var tile_bg1,tile_bg2;
  719.   var value;
  720.   
  721.   tile_bg1=$pat_block+0;
  722.   tile_bg2=$pat_block+4;
  723.   
  724.   value=(tile>=tile_bg1 && tile<=tile_bg2);
  725.   
  726.   return value;
  727. }
  728.  
  729. function block_sound(){
  730.  
  731.   var p1,p2,p;
  732.   var flag,tile;
  733.  
  734.   p1=$map.getAt(x  ,y);
  735.   p2=$map.getAt(x+8,y);
  736.   p3=$map.getAt(x-8,y);
  737.   tile=$pat_block+7;
  738.   
  739.   flag=((p1==tile || p2==tile || p3==tile) && before==0); 
  740.   if (flag==1) {
  741.     $mplayer.play($se_shoot03);
  742.     before=1;
  743.   }
  744.   if ((p1==tile || p2==tile || p3==tile)==0) before=0;
  745.  
  746. }
  747.  
  748. function magma(){
  749.   if ($map.getAt(x,y)==$pat_block+1) {
  750.     $mplayer.play($se_fm007);
  751.     /*
  752.     p=$pat_effect01+3;
  753.     updateEx(10);
  754.     p=$pat_effect01+4;
  755.     updateEx(10);
  756.     p=$pat_effect01+5;
  757.     updateEx(10);
  758.     */
  759.     die();
  760.   }
  761. }