fall_rotate_function

  1. //回転時のダメージ判定用
  2.  
  3. //################操作ブロックダメージ用################
  4.  
  5. function Fall_block_damege(Bnum:Number , Damege:Number , Option:Boolean = false, RimitOp:Boolean = false):void{
  6.  
  7. if(Bnum > 24 || Bnum < 0) return;
  8.  
  9. var to_sum:Number = Fall_Pool.Next_Block[0].BlockSum;
  10. var T_FallPoBl:BlockClass = Fall_Pool.Next_Pool[0][Bnum];
  11. if( !(T_FallPoBl.on_flag) ) return;
  12.  
  13. if( T_FallPoBl.Metal_flg ) return;
  14. if( T_FallPoBl.Crystal_flg ) return;
  15.  
  16. if(T_FallPoBl.Weight < 100 && Damege < 1000){
  17. if( !(RimitOp) || (T_FallPoBl.HP - ((Damege)|0)) >= (T_FallPoBl.MAXHP * (1 - Sys_Seting.FrictionFallParMax))){
  18. T_FallPoBl.HP -= ((Damege)|0);
  19. }
  20. }else{
  21. T_FallPoBl.HP -= ((Damege)|0);
  22. }
  23.  
  24. if( !(Option) ) return;
  25.  
  26. if(T_FallPoBl.HP > 0){
  27. T_FallPoBl.fream_counter = 11 - ((T_FallPoBl.HP < T_FallPoBl.MAXHP) ? (T_FallPoBl.HP/ T_FallPoBl.MAXHP * 10 )|0 : 10);//表示されるフレームを変更
  28. }else{
  29. T_FallPoBl.on_flag = false;//存在フラグ削除
  30. }
  31.  
  32. }
  33.  
  34. //################ブロックプールダメージ用################
  35.  
  36. function Main_block_damege( Bx:Number , By:Number , Damege:Number, Option:Boolean = false , RimitOp:Boolean = false , BreakMode:uint = 0):void{
  37. if(Bx < 0 || Bx >= Main_Pool.PoolMaxX){
  38. return;
  39. }
  40. if(By < 0 || By >= Main_Pool.PoolMaxY){
  41. return;
  42. }
  43.  
  44. if(Main_Pool.LineFall && temp_line_flg[By]){
  45. return;
  46. }
  47.  
  48. var T_MainPool:BlockClass = Main_Pool.BlockPool[Bx][By];
  49.  
  50. if( !(T_MainPool.on_flag) ) return;
  51. if( T_MainPool.Metal_flg && (BreakMode <= 0) ) return;
  52. if( T_MainPool.Crystal_flg && (BreakMode <= 1) ) return;
  53.  
  54. if( !(RimitOp) || (T_MainPool.HP - Damege) > (T_MainPool.MAXHP * (1 - Sys_Seting.FrictionMainParMax))){
  55. T_MainPool.HP -= Damege;
  56. }
  57.  
  58. if( !(Option) ) return;
  59.  
  60. if(T_MainPool.HP > 0){
  61. T_MainPool.fream_counter = 11 - ((T_MainPool.HP < T_MainPool.MAXHP) ? (T_MainPool.HP/ T_MainPool.MAXHP * 10)|0 : 10);//表示されるフレームを変更
  62. }else{
  63. T_MainPool.sys_number = 0;//システム上の連結属性をリセット
  64. T_MainPool.NextBreak_flg = false;//ライン巻き込みフラグ削除
  65. T_MainPool.on_flag = false;//存在フラグ削除
  66.  
  67. }
  68.  
  69. }
  70.  
  71. ・・・中略・・・
  72.  
  73. //操作ブロック回転時のダメージ判定のソース
  74. //################操作ブロック回転用################
  75.  
  76. fall_rotate_function():void{
  77.  
  78. if( !(VsWatchMode) ) Block_loopFunc(); //観戦モードでないなら回転開始処理を呼ぶ。
  79. if( !(Fall_Pool.rotat_block) ) return; //回転していないならメインに戻る。
  80.  
  81. var This_rotation:Number = Fall_Pool.this_rotation;
  82. var i:int = 0;
  83. var j:int = 0;
  84. var k:int = 0;
  85. var Temp_xMin:Number = 0;
  86. var Temp_yMin:Number = 0;
  87. var Temp_xMax:Number = 0;
  88. var Temp_yMax:Number = 0;
  89. var Temp_xy:Number = 0;
  90.  
  91. var temp_x_master:Number = 0;
  92. var temp_y_master:Number = 0;
  93. var temp_x:Number = 0;
  94. var temp_y:Number = 0;
  95. var this_x:Number = 0;
  96. var this_y:Number = 0;
  97. var to_sum:Number = Fall_Pool.Next_Block[0].BlockSum;
  98. var Fall_x:Number = Fall_Pool.this_x + 0.5;
  99. var Fall_y:Number = Fall_Pool.this_y + Fall_Pool.this_y_mili / Pool_BlockSize - 0.4375;
  100.  
  101. var sin:Number;
  102. var cos:Number;
  103.  
  104. if(This_rotation != 0 ){ //回転が終了していないなら当たり判定
  105.  
  106. if(Sys_Seting.Friction_flg){
  107. if(true){
  108. sin = Appro.sin(This_rotation); //sinを1度単位で並べた配列から値をGET
  109. cos = Appro.cos(This_rotation); //cosを1度単位で並べた配列から値をGET
  110.  
  111. for(i = 0; i < to_sum; i++ ){
  112. if( Fall_Pool.Next_Pool[0][i].on_flag ){// 5x5のブロックとして全ての点で計測
  113.  
  114. temp_x_master = Fall_Pool.Next_Block[0].B_x[i] * 4;
  115. temp_y_master = Fall_Pool.Next_Block[0].B_y[i] * 4;
  116.  
  117. for(j = -2; j <= 2; j++){
  118. for(k = -2; k <= 2; k++){
  119. temp_x = temp_x_master + j;
  120. temp_y = temp_y_master + k;
  121. this_x = (((cos * temp_x - sin * temp_y)/4 + Fall_x +1)|0) -1;
  122. this_y = (((sin * temp_x + cos * temp_y)/4 + Fall_y +1)|0) -1;
  123. if(this_x < 0 || this_x > Pool_x_delen || this_y > Pool_y_delen || this_y < 10){
  124. if(this_y >= 10) FallDamege_Ary[i] += Sys_Seting.FrictionFallDamege;
  125. }else{
  126. if( Main_Pool.BlockPool[this_x][this_y].on_flag ){
  127. FallDamege_Ary[i] += Sys_Seting.FrictionFallDamege;
  128. MainDamege_Ary[this_x][this_y] += Sys_Seting.FrictionMainDamege;
  129. }
  130. }
  131. }
  132. }
  133.  
  134. Fall_block_damege(i , FallDamege_Ary[i] , true , true);
  135. FallDamege_Ary[i] = 0;
  136. }
  137. }
  138. for(i = 0; i < Pool_y_len ; i++){
  139. for(j = 0; j < Pool_x_len; j++){
  140. if( Main_Pool.BlockPool[j][i].on_flag ){
  141. Main_block_damege( j, i, MainDamege_Ary[j][i] , true , true);
  142. }
  143. MainDamege_Ary[j][i] = 0;
  144. }
  145. }
  146. }
  147. }
  148. if(This_rotation > 0){ //判定が終わったら15度回す。
  149. This_rotation -= 15;
  150. }else{
  151. This_rotation += 15;
  152. }
  153.  
  154. if( !(VsWatchMode) ){ //観戦モードでないなら表示更新通知フラグをONにする。
  155. Main_Pool.MainPoolRefresh = true;
  156. Fall_Pool.StatusChen_flg = true;
  157. }
  158. }else{ //回転が終了した時
  159.  
  160. if( !(VsWatchMode) ){ //観戦モードでないならデータを送信
  161. Fall_Pool.this_rotation = This_rotation;
  162. Main_Pool.MainPoolRefresh = true;
  163. Fall_Pool.StatusChen_flg = true;
  164. Fall_Pool.rotat_block = false;
  165. NetDataWrite(false , true , true , true);//Count_flg , Fall_flg , Main_flg , Sys_flg
  166. }
  167.  
  168. }
  169.  
  170. ScoreNum_fuc(); //スコア処理
  171.  
  172. Fall_Pool.this_rotation = This_rotation; //角度を収める。
  173.  
  174. }
  175.  
  176.  
  177. //Approというクラスからsinやcosを参照しているが、これは端末ごとにsinやcosの計算結果が異なるため、
  178. //予め計算しておいた数値をリスト化してApproクラスで管理しているためである。
最終更新:2012年12月19日 07:24