pat.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. // 拍球的动作
  2. cc.Class({
  3. extends: cc.Component,
  4. properties: {
  5. loc: 0, // 代表方向,0为正位,1为反位
  6. },
  7. // LIFE-CYCLE CALLBACKS:
  8. // onLoad () {},
  9. start () {
  10. // 配置绘制的数据
  11. // 从配置中心获取数据
  12. this.config = require ("gameconfig")
  13. // 配置绘制组件
  14. this.g = this.getComponent(cc.Graphics);
  15. // 配置方向
  16. if (this.loc == 0) {
  17. this.dir = -1;
  18. } else {
  19. this.dir = 1;
  20. }
  21. // this.dir = -1;
  22. // this.pat_001();
  23. this.index = 1;
  24. },
  25. // update (dt) {},
  26. pat:function() {
  27. this.schedule(this.patUpdate, 1.0 / 15);
  28. },
  29. patUpdate:function(delay) {
  30. this.g.clear();
  31. if (this.index > 7) {
  32. this.index = 1;
  33. this.unschedule(this.patUpdate);
  34. if (this.actionEnd != null) {
  35. this.actionEnd();
  36. }
  37. return;
  38. }
  39. if (this.index == 1) {
  40. this.pat_001();
  41. } else if (this.index == 2) {
  42. this.pat_002();
  43. } else if (this.index == 3) {
  44. this.pat_003();
  45. } else if (this.index == 4) {
  46. this.pat_004();
  47. } else if (this.index == 5) {
  48. this.pat_005();
  49. } else if (this.index == 6) {
  50. this.pat_006();
  51. } else if (this.index == 7) {
  52. this.pat_007();
  53. }
  54. this.index++;
  55. },
  56. pat_001:function() {
  57. // 画脑袋
  58. this.g.lineWidth = this.config.LINE_WIDTH;
  59. this.g.fillColor.fromHEX('#ffffff');
  60. this.g.arc(this.dir * 1, 112, this.config.HEAD_SIZE + 2, Math.PI / 2 - this.dir * Math.PI / 12, Math.PI * 1.5 - this.dir * Math.PI / 12, this.dir == 1);
  61. this.g.lineTo(this.dir *12, 105);
  62. this.g.arc(this.dir *13, 111, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - this.dir * Math.PI / 12, Math.PI / 2 - this.dir * Math.PI / 12, this.dir == 1);
  63. this.g.lineTo(this.dir *2, 118);
  64. // 画个身体
  65. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  66. this.g.fillColor.fromHEX('#ffffff');
  67. this.g.circle(this.dir * 21, 81, this.config.BODY_SIZE);
  68. this.g.close();
  69. this.g.stroke();
  70. this.g.fill();
  71. // 画手臂
  72. var handStart = cc.v2(this.dir * 9, 89);
  73. var handEnd = cc.v2(handStart.x - this.dir * 52, handStart.y + 7);
  74. this.g.lineWidth = this.config.LINE_WIDTH;
  75. this.g.moveTo(handStart.x, handStart.y);
  76. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - this.dir * 30, handStart.y + 28, handEnd.x, handEnd.y);
  77. this.g.stroke();
  78. // 画个球拍
  79. this.g.lineWidth = this.config.LINE_WIDTH;
  80. this.g.fillColor.fromHEX('#ffffff');
  81. if (this.loc == 0) {
  82. this.g.arc(this.dir * -41, 105, this.config.BAT_SIZE + 2, 0 + Math.PI / 12, Math.PI + Math.PI / 12, true);
  83. } else {
  84. this.g.arc(this.dir * -41, 105, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 12, 0 - Math.PI / 12, false);
  85. }
  86. this.g.bezierCurveTo(this.dir * -37, 104, this.dir * -47, 80, this.dir * -24, 53);
  87. if (this.loc == 0) {
  88. this.g.arc(this.dir * -28, 51, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 12, Math.PI * 1.5 + Math.PI / 12, true);
  89. } else {
  90. this.g.arc(this.dir * -28, 51, this.config.BAT_SIZE + 2, 0 + Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, false);
  91. }
  92. this.g.bezierCurveTo(this.dir * -30, 46, this.dir * -60, 75, this.dir * -45, 106);
  93. // this.g.close();
  94. this.g.stroke();
  95. // 画手臂
  96. var handStart = cc.v2(this.dir * 35, 84);
  97. var handEnd = cc.v2(this.dir * 76, 61);
  98. this.g.lineWidth = this.config.LINE_WIDTH;
  99. this.g.moveTo(handStart.x, handStart.y);
  100. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 58, 55, handEnd.x, handEnd.y);
  101. this.g.stroke();
  102. // 画裤子
  103. var trousersStart = cc.v2(this.dir * 11, 73);
  104. var trousersEnd = cc.v2(this.dir * 33, 73);
  105. this.g.moveTo(trousersStart.x, trousersStart.y);
  106. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  107. this.g.stroke();
  108. // 画腿
  109. var legStart = cc.v2(this.dir * 12, 70);
  110. var legEnd = cc.v2(0, 0)
  111. this.g.moveTo(legStart.x, legStart.y);
  112. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -15, 60, legEnd.x, legEnd.y);
  113. this.g.lineTo(legEnd.x - this.dir * 10, legEnd.y);
  114. this.g.stroke();
  115. legStart = cc.v2(this.dir * 31, 69);
  116. legEnd = cc.v2(this.dir * 64, 2)
  117. this.g.moveTo(legStart.x, legStart.y);
  118. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 20, legStart.y - 10, legEnd.x, legEnd.y);
  119. this.g.lineTo(legEnd.x + this.dir * 10, legEnd.y);
  120. this.g.stroke();
  121. },
  122. pat_002:function() {
  123. // 画脑袋
  124. this.g.lineWidth = this.config.LINE_WIDTH;
  125. // 画手臂
  126. var handStart = cc.v2(this.dir * 32, 89);
  127. var handEnd = cc.v2(this.dir * 39, 139);
  128. this.g.lineWidth = this.config.LINE_WIDTH;
  129. this.g.moveTo(handStart.x, handStart.y);
  130. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 10, 125, handEnd.x, handEnd.y);
  131. this.g.stroke();
  132. this.g.fillColor.fromHEX('#ffffff');
  133. this.g.arc(this.dir * 27, 109, this.config.HEAD_SIZE, Math.PI / 2 - this.dir * Math.PI / 12, Math.PI * 1.5 - this.dir * Math.PI / 12, this.dir == 1);
  134. this.g.lineTo(this.dir * 45, 102);
  135. this.g.arc(this.dir * 45, 106, this.config.HEAD_SIZE, Math.PI * 1.5 - this.dir * Math.PI / 12, Math.PI / 2 - this.dir * Math.PI / 12, this.dir == 1);
  136. this.g.lineTo(this.dir * 27, 113);
  137. // 画个身体
  138. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  139. this.g.fillColor.fromHEX('#ffffff');
  140. this.g.circle(this.dir * 41, 82, this.config.BODY_SIZE);
  141. this.g.close();
  142. this.g.stroke();
  143. this.g.fill();
  144. // 画个球拍
  145. this.g.lineWidth = this.config.LINE_WIDTH;
  146. this.g.fillColor.fromHEX('#ffffff');
  147. if (this.loc == 0) {
  148. this.g.arc(32, 124, this.config.BAT_SIZE + 2, Math.PI / 2, Math.PI * 1.5, false);
  149. } else {
  150. this.g.arc(-32, 124, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 4, Math.PI * 1.5 + Math.PI / 8, true);
  151. }
  152. this.g.bezierCurveTo(this.dir * -31, 123, 0, 155, this.dir * 40, 134);
  153. if (this.loc == 0) {
  154. this.g.arc(-40, 138, this.config.BAT_SIZE + 2, Math.PI * 1.5 + Math.PI / 8, Math.PI / 2 + Math.PI / 4, false);
  155. } else {
  156. this.g.arc(42, 138, this.config.BAT_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 + Math.PI / 8, true);
  157. }
  158. this.g.bezierCurveTo(this.dir * 45, 142, 0, 162, this.dir * -37, 128);
  159. // // this.g.close();
  160. this.g.stroke();
  161. // 画手臂
  162. var handStart = cc.v2(this.dir * 52, 72);
  163. var handEnd = cc.v2(this.dir * 53, 25);
  164. this.g.lineWidth = this.config.LINE_WIDTH;
  165. this.g.moveTo(handStart.x, handStart.y);
  166. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 45, 55, handEnd.x, handEnd.y);
  167. this.g.stroke();
  168. // 画裤子
  169. var trousersStart = cc.v2(this.dir * 29, 78);
  170. var trousersEnd = cc.v2(this.dir * 51, 69);
  171. this.g.moveTo(trousersStart.x, trousersStart.y);
  172. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  173. this.g.stroke();
  174. // 画腿
  175. var legStart = cc.v2(this.dir * 32, 71);
  176. var legEnd = cc.v2(0, 0)
  177. this.g.moveTo(legStart.x, legStart.y);
  178. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 10, 38, legEnd.x, legEnd.y);
  179. this.g.lineTo(legEnd.x - this.dir * 6, legEnd.y);
  180. this.g.stroke();
  181. legStart = cc.v2(this.dir * 43, 67);
  182. legEnd = cc.v2(this.dir * 64, 2)
  183. this.g.moveTo(legStart.x, legStart.y);
  184. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 62, 55, legEnd.x, legEnd.y);
  185. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  186. this.g.stroke();
  187. },
  188. pat_003:function() {
  189. // 画脑袋
  190. this.g.lineWidth = this.config.LINE_WIDTH;
  191. this.g.fillColor.fromHEX('#ffffff');
  192. // this.g.ellipse(18, 116, 15, 5);
  193. this.g.arc(this.dir * 53, 104, this.config.HEAD_SIZE + 1, Math.PI / 2 - this.dir * Math.PI / 12, Math.PI * 1.5 - this.dir * Math.PI / 8, this.dir == 1);
  194. this.g.lineTo(this.dir * 65, 96);
  195. this.g.arc(this.dir * 66, 101, this.config.HEAD_SIZE + 1, Math.PI * 1.5 - this.dir * Math.PI / 8, Math.PI / 2 - this.dir * Math.PI / 8, this.dir == 1);
  196. this.g.lineTo(this.dir * 49, 110);;
  197. // 画个身体
  198. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  199. this.g.fillColor.fromHEX('#ffffff');
  200. this.g.circle(this.dir * 54, 78, this.config.BODY_SIZE);
  201. this.g.close();
  202. this.g.stroke();
  203. this.g.fill();
  204. // 画手臂
  205. var handStart = cc.v2(this.dir * 45, 89);
  206. var handEnd = cc.v2(this.dir * 70, 135);
  207. this.g.lineWidth = this.config.LINE_WIDTH;
  208. this.g.moveTo(handStart.x, handStart.y);
  209. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 20, 128, handEnd.x, handEnd.y);
  210. this.g.stroke();
  211. // 画个球
  212. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  213. this.g.fillColor.fromHEX('#ffffff');
  214. this.g.circle(handEnd.x - this.dir * 1, handEnd.y - 5, this.config.BAT_SIZE);
  215. this.g.close();
  216. this.g.stroke();
  217. this.g.fill();
  218. // 画手臂
  219. var handStart = cc.v2(this.dir * 55, 63);
  220. var handEnd = cc.v2(this.dir * 56, 30);
  221. this.g.lineWidth = this.config.LINE_WIDTH;
  222. this.g.moveTo(handStart.x, handStart.y);
  223. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 40, 40, handEnd.x, handEnd.y);
  224. // this.g.lineTo(handEnd.x, handEnd.y);
  225. this.g.stroke();
  226. // 画裤子
  227. var trousersStart = cc.v2(this.dir * 41, 73);
  228. var trousersEnd = cc.v2(this.dir * 63, 66);
  229. this.g.moveTo(trousersStart.x, trousersStart.y);
  230. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  231. this.g.stroke();
  232. // 画腿
  233. var legStart = cc.v2(this.dir * 44, 67);
  234. var legEnd = cc.v2(0, 0)
  235. this.g.moveTo(legStart.x, legStart.y);
  236. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 30, 52, legEnd.x, legEnd.y);
  237. this.g.lineTo(legEnd.x - this.dir * 6, legEnd.y);
  238. this.g.stroke();
  239. legStart = cc.v2(this.dir * 57, 64);
  240. legEnd = cc.v2(this.dir * 63, 1)
  241. this.g.moveTo(legStart.x, legStart.y);
  242. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 40, legStart.y - 15, legEnd.x, legEnd.y);
  243. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  244. this.g.stroke();
  245. },
  246. pat_004:function() {
  247. // 画脑袋
  248. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  249. // 画个脑袋
  250. this.g.fillColor.fromHEX('#ffffff');
  251. this.g.circle(this.dir * 84, 92, this.config.HEAD_SIZE);
  252. this.g.close();
  253. this.g.stroke();
  254. this.g.fill();
  255. // 画个身体
  256. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  257. this.g.fillColor.fromHEX('#ffffff');
  258. this.g.circle(this.dir * 66, 73, this.config.BODY_SIZE);
  259. this.g.close();
  260. this.g.stroke();
  261. this.g.fill();
  262. // 画手臂
  263. var handStart = cc.v2(this.dir * 67, 88);
  264. var handEnd = cc.v2(this.dir * 105, 90);
  265. this.g.lineWidth = this.config.LINE_WIDTH;
  266. this.g.moveTo(handStart.x, handStart.y);
  267. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 94, 125, handEnd.x, handEnd.y);
  268. this.g.stroke();
  269. // 画个球拍
  270. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  271. this.g.fillColor.fromHEX('#ffffff');
  272. this.g.circle(handEnd.x - this.dir * 4, handEnd.y - 5, this.config.BAT_SIZE);
  273. this.g.close();
  274. this.g.stroke();
  275. this.g.fill();
  276. // 画手臂
  277. var handStart = cc.v2(this.dir * 68, 59);
  278. var handEnd = cc.v2(this.dir * 60, 33);
  279. this.g.lineWidth = this.config.LINE_WIDTH;
  280. this.g.moveTo(handStart.x, handStart.y);
  281. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 50, 40, handEnd.x, handEnd.y);
  282. // this.g.lineTo(handEnd.x, handEnd.y);
  283. this.g.stroke();
  284. // 画裤子
  285. var trousersStart = cc.v2(this.dir * 51, 72);
  286. var trousersEnd = cc.v2(this.dir * 70, 60);
  287. this.g.moveTo(trousersStart.x, trousersStart.y);
  288. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  289. this.g.stroke();
  290. // 画腿
  291. var legStart = cc.v2(this.dir * 53, 66);
  292. var legEnd = cc.v2(0, 0)
  293. this.g.moveTo(legStart.x, legStart.y);
  294. this.g.lineTo(legEnd.x, legEnd.y);
  295. this.g.stroke();
  296. legStart = cc.v2(this.dir * 68, 57);
  297. legEnd = cc.v2(this.dir * 63, 1)
  298. this.g.moveTo(legStart.x, legStart.y);
  299. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 38, legStart.y - 18, legEnd.x, legEnd.y);
  300. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  301. this.g.stroke();
  302. },
  303. pat_005:function() {
  304. // 画脑袋
  305. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  306. // 画个脑袋
  307. this.g.fillColor.fromHEX('#ffffff');
  308. this.g.circle(this.dir * 60, 86, this.config.HEAD_SIZE);
  309. this.g.close();
  310. this.g.stroke();
  311. this.g.fill();
  312. // 画个身体
  313. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  314. this.g.fillColor.fromHEX('#ffffff');
  315. this.g.circle(this.dir * 43, 66, this.config.BODY_SIZE);
  316. this.g.close();
  317. this.g.stroke();
  318. this.g.fill();
  319. // 画手臂
  320. var handStart = cc.v2(this.dir * 37, 78);
  321. var handEnd = cc.v2(this.dir * 62, 110);
  322. this.g.lineWidth = this.config.LINE_WIDTH;
  323. this.g.moveTo(handStart.x, handStart.y);
  324. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 20, 120, handEnd.x, handEnd.y);
  325. this.g.stroke();
  326. // 画个球拍
  327. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  328. this.g.fillColor.fromHEX('#ffffff');
  329. this.g.circle(handEnd.x - this.dir * 4, handEnd.y - 5, this.config.BAT_SIZE);
  330. this.g.close();
  331. this.g.stroke();
  332. this.g.fill();
  333. // 画手臂
  334. var handStart = cc.v2(this.dir * 56, 61);
  335. var handEnd = cc.v2(this.dir * 80, 25);
  336. this.g.lineWidth = this.config.LINE_WIDTH;
  337. this.g.moveTo(handStart.x, handStart.y);
  338. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 70, 32, handEnd.x, handEnd.y);
  339. // this.g.lineTo(handEnd.x, handEnd.y);
  340. this.g.stroke();
  341. // 画裤子
  342. var trousersStart = cc.v2(this.dir * 28, 61);
  343. var trousersEnd = cc.v2(this.dir * 53, 55);
  344. this.g.moveTo(trousersStart.x, trousersStart.y);
  345. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  346. this.g.stroke();
  347. // 画腿
  348. var legStart = cc.v2(this.dir * 33, 54);
  349. var legEnd = cc.v2(this.dir * 6, 0)
  350. this.g.moveTo(legStart.x, legStart.y);
  351. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -15, 52, legEnd.x, legEnd.y);
  352. this.g.lineTo(0, 0);
  353. this.g.stroke();
  354. legStart = cc.v2(this.dir * 51, 52);
  355. legEnd = cc.v2(this.dir * 68, 1)
  356. this.g.moveTo(legStart.x, legStart.y);
  357. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 38, legStart.y - 18, legEnd.x, legEnd.y);
  358. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  359. this.g.stroke();
  360. },
  361. pat_006:function() {
  362. // 画脑袋
  363. this.g.lineWidth = this.config.LINE_WIDTH;
  364. this.g.fillColor.fromHEX('#ffffff');
  365. // this.g.ellipse(18, 116, 15, 5);
  366. this.g.arc(this.dir * 37, 104, this.config.HEAD_SIZE + 2, Math.PI / 2 - this.dir * Math.PI / 8, Math.PI * 1.5 - this.dir * Math.PI / 8, this.dir == 1);
  367. this.g.lineTo(this.dir * 44, 96);
  368. this.g.arc(this.dir * 46, 101, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - this.dir * Math.PI / 8, Math.PI / 2 - this.dir * Math.PI / 8, this.dir == 1);
  369. this.g.lineTo(this.dir * 38, 110);
  370. // // this.g.close();
  371. // // this.g.stroke();
  372. // // this.g.fill();
  373. // 画个身体
  374. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  375. this.g.fillColor.fromHEX('#ffffff');
  376. this.g.circle(this.dir * 32, 78, this.config.BODY_SIZE);
  377. this.g.close();
  378. this.g.stroke();
  379. this.g.fill();
  380. // 画手臂
  381. var handStart = cc.v2(this.dir * 23, 88);
  382. var handEnd = cc.v2(this.dir * -12, 127);
  383. this.g.lineWidth = this.config.LINE_WIDTH;
  384. this.g.moveTo(handStart.x, handStart.y);
  385. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * -23, 95, handEnd.x, handEnd.y);
  386. this.g.stroke();
  387. // 画个球拍
  388. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  389. this.g.fillColor.fromHEX('#ffffff');
  390. this.g.circle(handEnd.x + this.dir * 5, handEnd.y - 1, this.config.BAT_SIZE);
  391. this.g.close();
  392. this.g.stroke();
  393. this.g.fill();
  394. // 画手臂
  395. var handStart = cc.v2(this.dir * 46, 81);
  396. var handEnd = cc.v2(this.dir * 76, 49);
  397. this.g.lineWidth = this.config.LINE_WIDTH;
  398. this.g.moveTo(handStart.x, handStart.y);
  399. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 75, 82, handEnd.x, handEnd.y);
  400. // this.g.lineTo(handEnd.x, handEnd.y);
  401. this.g.stroke();
  402. // 画裤子
  403. var trousersStart = cc.v2(this.dir * 19, 71);
  404. var trousersEnd = cc.v2(this.dir * 42, 67);
  405. this.g.moveTo(trousersStart.x, trousersStart.y);
  406. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  407. this.g.stroke();
  408. // 画腿
  409. var legStart = cc.v2(this.dir * 22, 66);
  410. var legEnd = cc.v2(this.dir * 6, 0)
  411. this.g.moveTo(legStart.x, legStart.y);
  412. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -10, 52, legEnd.x, legEnd.y);
  413. this.g.lineTo(0, 0);
  414. this.g.stroke();
  415. legStart = cc.v2(this.dir * 38, 64);
  416. legEnd = cc.v2(this.dir * 68, 1)
  417. this.g.moveTo(legStart.x, legStart.y);
  418. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 65, 55, legEnd.x, legEnd.y);
  419. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  420. this.g.stroke();
  421. },
  422. pat_007:function() {
  423. // 画脑袋
  424. this.g.lineWidth = this.config.LINE_WIDTH;
  425. this.g.fillColor.fromHEX('#ffffff');
  426. this.g.arc(this.dir * -4, 111.5, this.config.HEAD_SIZE, Math.PI / 2, Math.PI * 1.5, this.dir == 1);
  427. this.g.lineTo(this.dir * 8, 106.5);
  428. this.g.arc(this.dir * 7, 111.5, this.config.HEAD_SIZE, Math.PI * 1.5 , Math.PI / 2, this.dir == 1);
  429. this.g.lineTo(this.dir * -4, 116);
  430. // 画个身体
  431. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  432. this.g.fillColor.fromHEX('#ffffff');
  433. this.g.circle(this.dir * 7, 87, this.config.BODY_SIZE);
  434. this.g.close();
  435. this.g.stroke();
  436. this.g.fill();
  437. // 画手臂
  438. var handStart = cc.v2(this.dir * -8, 87);
  439. var handEnd = cc.v2(this.dir * -32, 45);
  440. this.g.lineWidth = this.config.LINE_WIDTH;
  441. this.g.moveTo(handStart.x, handStart.y);
  442. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * -15, 55, handEnd.x, handEnd.y);
  443. this.g.stroke();
  444. // 画个球拍
  445. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  446. this.g.fillColor.fromHEX('#ffffff');
  447. this.g.circle(handEnd.x + this.dir * 1, handEnd.y + 6, this.config.BAT_SIZE);
  448. this.g.close();
  449. this.g.stroke();
  450. this.g.fill();
  451. // 画手臂
  452. var handStart = cc.v2(this.dir * 16, 99);
  453. var handEnd = cc.v2(this.dir * 65, 83);
  454. this.g.lineWidth = this.config.LINE_WIDTH;
  455. this.g.moveTo(handStart.x, handStart.y);
  456. this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 45, 110, handEnd.x, handEnd.y);
  457. // this.g.lineTo(handEnd.x, handEnd.y);
  458. this.g.stroke();
  459. // 画裤子
  460. var trousersStart = cc.v2(this.dir * -3, 75);
  461. var trousersEnd = cc.v2(this.dir * 23, 85);
  462. this.g.moveTo(trousersStart.x, trousersStart.y);
  463. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  464. this.g.stroke();
  465. // 画腿
  466. var legStart = cc.v2(this.dir * 8, 72);
  467. var legEnd = cc.v2(0, 0)
  468. this.g.moveTo(legStart.x, legStart.y);
  469. this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -15, 56, legEnd.x, legEnd.y);
  470. this.g.lineTo(this.dir * -6, 0);
  471. this.g.stroke();
  472. legStart = cc.v2(this.dir * 18, 77);
  473. legEnd = cc.v2(this.dir * 63, 1)
  474. this.g.moveTo(legStart.x, legStart.y);
  475. this.g.lineTo(legEnd.x, legEnd.y)
  476. this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
  477. this.g.stroke();
  478. },
  479. });