pat.js 21 KB

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