すくすくゴートうちゃん Android 版(黒歴史)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

224 lines
4.1 KiB

  1. #ifndef __GOATOH__
  2. #define __GOATOH__
  3. /**
  4. * ゴートうひとり(ムムムム!)
  5. *
  6. * @property double posX
  7. * @property double posY
  8. * @property double[] legArgs
  9. */
  10. #module \
  11. Goatoh
  12. #enum LEG_LF = 0
  13. #enum LEG_RF
  14. #enum LEG_LH
  15. #enum LEG_RH
  16. #enum LEG_DIRECTION_FRONT = 1
  17. #enum LEG_DIRECTION_HIND
  18. /**
  19. * コンストラクタ:ゴートうを生成する.
  20. *
  21. * @param double initPosX
  22. * @param double initPosY
  23. * @param int initDirection
  24. */
  25. #defcfunc local \
  26. New \
  27. double p_initPosX,\
  28. double p_initPosY,\
  29. int p_initDirection
  30. posX.insNum = p_initPosX
  31. posY.insNum = p_initPosY
  32. If Length2 (legArgs) = 0 {
  33. DDim legArgs, 4, 1
  34. }
  35. If Length2 (legDirections) = 0 {
  36. Dim legDirections, 4, 1
  37. }
  38. legArgs.LEG_LF.insNum = 0.
  39. legArgs.LEG_RF.insNum = 0.
  40. legArgs.LEG_LH.insNum = 0.
  41. legArgs.LEG_RH.insNum = 0.
  42. legDirections.LEG_LF.insNum = LEG_DIRECTION_FRONT
  43. legDirections.LEG_RF.insNum = LEG_DIRECTION_HIND
  44. legDirections.LEG_LH.insNum = LEG_DIRECTION_HIND
  45. legDirections.LEG_RH.insNum = LEG_DIRECTION_FRONT
  46. scale.insNum = 2.
  47. ; 角度
  48. arg.insNum = 0.
  49. ; 首の角度
  50. neckArg.insNum = 0.
  51. walkVel.insNum = 3.
  52. walkAcl.insNum = 0.
  53. runVel.insNum = 5.
  54. runVel.insNum = 0.
  55. direction.insNum = p_initDirection
  56. walking.insNum = True
  57. running.insNum = False
  58. eating.insNum = False
  59. openingEyes.insNum = False
  60. openingMouth.insNum = False
  61. frame.insNum = 0
  62. insNum++
  63. Return insNum - 1
  64. /**
  65. * ゴートうを歩かせる.
  66. *
  67. * @return void
  68. */
  69. #deffunc local \
  70. Walk \
  71. int p_insId
  72. If direction.p_insId = DIRECTION_LEFT {
  73. posX.p_insId -= walkVel.p_insId * Cos (arg.p_insId)
  74. posY.p_insId -= walkVel.p_insId * Sin (arg.p_insId)
  75. }
  76. Else {
  77. posX.p_insId += walkVel.p_insId * Cos (arg.p_insId)
  78. posY.p_insId += walkVel.p_insId * Sin (arg.p_insId)
  79. }
  80. Repeat 4
  81. If legDirections.cnt.p_insId = LEG_DIRECTION_FRONT {
  82. legArgs.cnt.p_insId += Deg2Rad (1)
  83. }
  84. Else {
  85. legArgs.cnt.p_insId -= Deg2Rad (1)
  86. }
  87. If legArgs.cnt.p_insId > Deg2Rad (15) {
  88. legDirections.cnt.p_insId = LEG_DIRECTION_HIND
  89. }
  90. Else: If legArgs.cnt.p_insId < Deg2Rad (-15) {
  91. legDirections.cnt.p_insId = LEG_DIRECTION_FRONT
  92. }
  93. Loop
  94. Return
  95. /**
  96. * ゴートうを走らせる.
  97. *
  98. * @return void
  99. */
  100. #deffunc local \
  101. DoRun \
  102. int p_insId
  103. Return
  104. /**
  105. * クサタベテル!!!
  106. *
  107. * @return void
  108. */
  109. #deffunc local \
  110. Eat \
  111. int p_insId
  112. Return
  113. /**
  114. * ゴートうを描画する.
  115. *
  116. * @return void
  117. */
  118. #deffunc local \
  119. Draw
  120. Repeat insNum
  121. Pos posX.cnt - scale.cnt * 50, posY.cnt + scale.cnt * 26
  122. CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_RF.cnt
  123. Pos posX.cnt + scale.cnt * 30, posY.cnt + scale.cnt * 26
  124. CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_RH.cnt
  125. Pos posX.cnt + scale.cnt * 64, posY.cnt - scale.cnt * 12
  126. CelPut BUFFER_GOATOH_TAIL, 0, scale.cnt, scale.cnt
  127. Pos posX.cnt, posY.cnt
  128. CelPut BUFFER_GOATOH_TARSO, 0, scale.cnt, scale.cnt
  129. Pos posX.cnt - scale.cnt * 30, posY.cnt + scale.cnt * 30
  130. CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_LF.cnt
  131. Pos posX.cnt + scale.cnt * 50, posY.cnt + scale.cnt * 30
  132. CelPut BUFFER_GOATOH_LEG, 0, scale.cnt, scale.cnt, legArgs.LEG_LH.cnt
  133. Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20
  134. CelPut BUFFER_GOATOH_HEAD, 0, scale.cnt, scale.cnt, neckArg.cnt
  135. Pos posX.cnt - scale.cnt * 64, posY.cnt - scale.cnt * 20
  136. If openingEyes {
  137. If openingMouth {
  138. CelPut BUFFER_GOATOH_FACE_OO, 0, scale.cnt, scale.cnt, neckArg.cnt
  139. }
  140. Else {
  141. CelPut BUFFER_GOATOH_FACE_OC, 0, scale.cnt, scale.cnt, neckArg.cnt
  142. }
  143. }
  144. Else {
  145. If openingMouth {
  146. CelPut BUFFER_GOATOH_FACE_CO, 0, scale.cnt, scale.cnt, neckArg.cnt
  147. }
  148. Else {
  149. CelPut BUFFER_GOATOH_FACE_CC, 0, scale.cnt, scale.cnt, neckArg.cnt
  150. }
  151. }
  152. Loop
  153. Interval@Goatoh
  154. Return
  155. /**
  156. * 描画ごとの内部処理を行う.
  157. *
  158. * @return void
  159. */
  160. #deffunc local \
  161. Interval
  162. Repeat insNum
  163. If walking.cnt {
  164. Walk@Goatoh cnt
  165. If frame.cnt \ 150 == 30 {
  166. MMPlay SOUND_MUMUMUMU
  167. openingMouth = True
  168. }
  169. }
  170. Else: If running.cnt {
  171. DoRun@Goatoh cnt
  172. }
  173. If eating.cnt {
  174. Eat@Goatoh cnt
  175. }
  176. frame.cnt++
  177. Loop
  178. Return
  179. #global
  180. #endif ; not __GOATOH__