serve.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  1. // 发球动作
  2. // 共有18个动作
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. loc: 0, // 代表方向,0为正位,1为反位
  7. },
  8. // LIFE-CYCLE CALLBACKS:
  9. onLoad () {
  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.index = 1;
  22. },
  23. // start () {},
  24. // update (dt) {},
  25. serve:function() {
  26. this.schedule(this.serveUpdate, 0.1);
  27. // this.serve_014();
  28. },
  29. // 发球的定时器
  30. serveUpdate:function(delay) {
  31. if (this.index > 19) {
  32. this.index = 1;
  33. }
  34. this.g.clear();
  35. if (this.index == 1) {
  36. this.serve_001();
  37. if (this.actionStart != null) {
  38. this.actionStart();
  39. }
  40. } else if (this.index == 2) {
  41. this.serve_002();
  42. } else if (this.index == 3) {
  43. this.serve_003();
  44. } else if (this.index == 4) {
  45. this.serve_004();
  46. } else if (this.index == 5) {
  47. this.serve_005();
  48. } else if (this.index == 6) {
  49. this.serve_006();
  50. } else if (this.index == 7) {
  51. this.serve_007();
  52. } else if (this.index == 8) {
  53. this.serve_008();
  54. } else if (this.index == 9) {
  55. this.serve_009();
  56. } else if (this.index == 10) {
  57. this.serve_010();
  58. } else if (this.index == 11) {
  59. this.serve_011();
  60. } else if (this.index == 12) {
  61. this.serve_012();
  62. } else if (this.index == 13) {
  63. this.serve_013();
  64. } else if (this.index == 14) {
  65. this.serve_014();
  66. } else if (this.index == 15) {
  67. this.serve_015();
  68. } else if (this.index == 16) {
  69. this.serve_016();
  70. } else if (this.index == 17) {
  71. this.serve_017();
  72. } else if (this.index == 18) {
  73. this.serve_018();
  74. } else if (this.index == 19) {
  75. this.serve_019();
  76. if (this.actionEnd != null) {
  77. this.unschedule(this.serveUpdate);
  78. this.actionEnd();
  79. }
  80. }
  81. this.index++;
  82. },
  83. // 一下全是画动作
  84. serve_001:function() {
  85. // 画脑袋
  86. this.g.lineWidth = this.config.LINE_WIDTH;
  87. this.g.fillColor.fromHEX('#ffffff');
  88. // this.g.ellipse(18, 116, 15, 5);
  89. this.g.arc(14, 112, this.config.HEAD_SIZE + 2, Math.PI / 2 + Math.PI / 12, Math.PI * 1.5 + Math.PI / 12, true);
  90. this.g.lineTo(29, 107.5);
  91. this.g.arc(27, 113, this.config.HEAD_SIZE + 2, Math.PI * 1.5 + Math.PI / 12, Math.PI / 2 + Math.PI / 12, true);
  92. this.g.lineTo(11, 118);
  93. // this.g.close();
  94. // this.g.stroke();
  95. // this.g.fill();
  96. // 画个身体
  97. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  98. this.g.fillColor.fromHEX('#ffffff');
  99. this.g.circle(29, 87, this.config.BODY_SIZE);
  100. this.g.close();
  101. this.g.stroke();
  102. this.g.fill();
  103. // 画手臂
  104. var handStart = cc.v2(15, 93);
  105. var handEnd = cc.v2(handStart.x - 19, handStart.y - 41);
  106. this.g.lineWidth = this.config.LINE_WIDTH;
  107. this.g.moveTo(handStart.x, handStart.y);
  108. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 13, handStart.y - 50, handEnd.x, handEnd.y);
  109. this.g.stroke();
  110. // 画个球
  111. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  112. this.g.fillColor.fromHEX('#ffffff');
  113. this.g.circle(handEnd.x - 2, handEnd.y + 4, 4);
  114. this.g.close();
  115. this.g.stroke();
  116. this.g.fill();
  117. // 画手臂
  118. var handStart = cc.v2(39, 98);
  119. var handEnd = cc.v2(handStart.x + 41, handStart.y - 31);
  120. this.g.lineWidth = this.config.LINE_WIDTH;
  121. this.g.moveTo(handStart.x, handStart.y);
  122. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 30, handStart.y + 15, handEnd.x, handEnd.y);
  123. this.g.stroke();
  124. // 画裤子
  125. var trousersStart = cc.v2(19, 78);
  126. var trousersEnd = cc.v2(41, 76);
  127. this.g.moveTo(trousersStart.x, trousersStart.y);
  128. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  129. this.g.stroke();
  130. // 画腿
  131. var legStart = cc.v2(18, 75);
  132. var legEnd = cc.v2(0, 0)
  133. this.g.moveTo(legStart.x, legStart.y);
  134. this.g.bezierCurveTo(legStart.x, legStart.y, -3, 55, legEnd.x, legEnd.y);
  135. this.g.lineTo(legEnd.x - 10, legEnd.y);
  136. this.g.stroke();
  137. legStart = cc.v2(33, 75);
  138. legEnd = cc.v2(64, 0)
  139. this.g.moveTo(legStart.x, legStart.y);
  140. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 20, legStart.y - 5, legEnd.x, legEnd.y);
  141. this.g.lineTo(legEnd.x + 10, legEnd.y);
  142. this.g.stroke();
  143. },
  144. serve_002:function() {
  145. // 画脑袋
  146. this.g.lineWidth = this.config.LINE_WIDTH;
  147. this.g.fillColor.fromHEX('#ffffff');
  148. // this.g.ellipse(18, 116, 15, 5);
  149. this.g.arc(27, 113, this.config.HEAD_SIZE + 2, Math.PI / 2 - Math.PI / 8, Math.PI * 1.5 - Math.PI / 8, true);
  150. this.g.lineTo(48, 97);
  151. this.g.arc(49, 103, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  152. this.g.lineTo(28, 119);
  153. // // this.g.close();
  154. // // this.g.stroke();
  155. // // this.g.fill();
  156. // 画个身体
  157. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  158. this.g.fillColor.fromHEX('#ffffff');
  159. this.g.circle(51, 76, this.config.BODY_SIZE);
  160. this.g.close();
  161. this.g.stroke();
  162. this.g.fill();
  163. // 画手臂
  164. var handStart = cc.v2(38, 82);
  165. var handEnd = cc.v2(handStart.x - 36, handStart.y - 23);
  166. this.g.lineWidth = this.config.LINE_WIDTH;
  167. this.g.moveTo(handStart.x, handStart.y);
  168. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 30, handStart.y - 30, handEnd.x, handEnd.y);
  169. this.g.stroke();
  170. // 画个球
  171. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  172. this.g.fillColor.fromHEX('#ffffff');
  173. this.g.circle(handEnd.x - 1, handEnd.y + 4, this.config.BAT_SIZE);
  174. this.g.close();
  175. this.g.stroke();
  176. this.g.fill();
  177. // 画手臂
  178. var handStart = cc.v2(61, 86);
  179. var handEnd = cc.v2(handStart.x + 9, handStart.y - 27);
  180. this.g.lineWidth = this.config.LINE_WIDTH;
  181. this.g.moveTo(handStart.x, handStart.y);
  182. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 60, handStart.y - 11, handEnd.x, handEnd.y);
  183. this.g.stroke();
  184. // 画裤子
  185. var trousersStart = cc.v2(38, 67);
  186. var trousersEnd = cc.v2(61, 67);
  187. this.g.moveTo(trousersStart.x, trousersStart.y);
  188. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  189. this.g.stroke();
  190. // 画腿
  191. var legStart = cc.v2(40, 63);
  192. var legEnd = cc.v2(0, 0)
  193. this.g.moveTo(legStart.x, legStart.y);
  194. this.g.bezierCurveTo(legStart.x, legStart.y, -5, 60, legEnd.x, legEnd.y);
  195. this.g.lineTo(legEnd.x - 6, legEnd.y);
  196. this.g.stroke();
  197. legStart = cc.v2(57, 65);
  198. legEnd = cc.v2(60, 0)
  199. this.g.moveTo(legStart.x, legStart.y);
  200. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 55, legStart.y - 35, legEnd.x, legEnd.y);
  201. this.g.lineTo(legEnd.x + 6, legEnd.y);
  202. this.g.stroke();
  203. },
  204. serve_003:function() {
  205. // 画脑袋和身体
  206. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  207. // 画个脑袋
  208. this.g.fillColor.fromHEX('#ffffff');
  209. this.g.circle(54, 105, this.config.HEAD_SIZE);
  210. this.g.close();
  211. this.g.stroke();
  212. this.g.fill();
  213. // 画个身体
  214. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  215. this.g.fillColor.fromHEX('#ffffff');
  216. this.g.circle(45, 81, this.config.BODY_SIZE);
  217. this.g.close();
  218. this.g.stroke();
  219. this.g.fill();
  220. // 画手臂
  221. var handStart = cc.v2(30, 82);
  222. var handEnd = cc.v2(handStart.x - 24, handStart.y - 18);
  223. this.g.lineWidth = this.config.LINE_WIDTH;
  224. this.g.moveTo(handStart.x, handStart.y);
  225. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 20, handStart.y - 25, handEnd.x, handEnd.y);
  226. this.g.stroke();
  227. // 画个球
  228. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  229. this.g.fillColor.fromHEX('#ffffff');
  230. this.g.circle(handEnd.x - 1, handEnd.y + 4, this.config.BAT_SIZE);
  231. this.g.close();
  232. this.g.stroke();
  233. this.g.fill();
  234. // 画手臂
  235. var handStart = cc.v2(57, 90);
  236. var handEnd = cc.v2(handStart.x - 31, handStart.y + 10);
  237. this.g.lineWidth = this.config.LINE_WIDTH;
  238. this.g.moveTo(handStart.x, handStart.y);
  239. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x + 45, handStart.y - 45, handEnd.x, handEnd.y);
  240. this.g.stroke();
  241. // 画裤子
  242. var trousersStart = cc.v2(32, 71);
  243. var trousersEnd = cc.v2(56, 73);
  244. this.g.moveTo(trousersStart.x, trousersStart.y);
  245. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  246. this.g.stroke();
  247. // 画腿
  248. var legStart = cc.v2(41, 68);
  249. var legEnd = cc.v2(0, 0)
  250. this.g.moveTo(legStart.x, legStart.y);
  251. this.g.bezierCurveTo(legStart.x, legStart.y, 0, 60, legEnd.x, legEnd.y);
  252. this.g.lineTo(legEnd.x - 6, legEnd.y);
  253. this.g.stroke();
  254. legStart = cc.v2(54, 69);
  255. legEnd = cc.v2(61, 2)
  256. this.g.moveTo(legStart.x, legStart.y);
  257. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 50, legStart.y - 30, legEnd.x, legEnd.y);
  258. this.g.lineTo(legEnd.x + 6, legEnd.y);
  259. this.g.stroke();
  260. },
  261. serve_004:function() {
  262. this.serve_003();
  263. },
  264. serve_004:function() {
  265. this.serve_003();
  266. },
  267. serve_005:function() {
  268. this.serve_003();
  269. },
  270. serve_006:function() {
  271. this.serve_003();
  272. },
  273. serve_007:function() {
  274. this.serve_003();
  275. },
  276. serve_008:function() {
  277. this.serve_003();
  278. },
  279. serve_009:function() {
  280. this.serve_003();
  281. },
  282. serve_010:function() {
  283. this.serve_003();
  284. },
  285. serve_011:function() {
  286. this.serve_003();
  287. },
  288. serve_012:function() {
  289. this.serve_003();
  290. },
  291. serve_013:function() {
  292. // 画脑袋
  293. this.g.lineWidth = this.config.LINE_WIDTH;
  294. this.g.fillColor.fromHEX('#ffffff');
  295. // this.g.ellipse(18, 116, 15, 5);
  296. this.g.arc(1, 112, this.config.HEAD_SIZE + 2, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, true);
  297. this.g.lineTo(12, 105);
  298. this.g.arc(13, 111, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - Math.PI / 12, Math.PI / 2 - Math.PI / 12, true);
  299. this.g.lineTo(2, 118);
  300. // 画个身体
  301. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  302. this.g.fillColor.fromHEX('#ffffff');
  303. this.g.circle(21, 81, this.config.BODY_SIZE);
  304. this.g.close();
  305. this.g.stroke();
  306. this.g.fill();
  307. // 画手臂
  308. var handStart = cc.v2(9, 89);
  309. var handEnd = cc.v2(handStart.x - 52, handStart.y + 7);
  310. this.g.lineWidth = this.config.LINE_WIDTH;
  311. this.g.moveTo(handStart.x, handStart.y);
  312. this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - 30, handStart.y + 28, handEnd.x, handEnd.y);
  313. this.g.stroke();
  314. // 画个球拍
  315. this.g.lineWidth = this.config.LINE_WIDTH;
  316. this.g.fillColor.fromHEX('#ffffff');
  317. this.g.arc(-41, 105, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 12, 0 - Math.PI / 12, false);
  318. this.g.bezierCurveTo(-37, 104, -47, 80, -24, 53);
  319. this.g.arc(-28, 51, this.config.BAT_SIZE + 2, 0 + Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, false);
  320. this.g.bezierCurveTo(-30, 46, -60, 75, -45, 106);
  321. // this.g.close();
  322. this.g.stroke();
  323. // this.g.fill();
  324. // 画手臂
  325. var handStart = cc.v2(35, 84);
  326. var handEnd = cc.v2(76, 61);
  327. this.g.lineWidth = this.config.LINE_WIDTH;
  328. this.g.moveTo(handStart.x, handStart.y);
  329. this.g.bezierCurveTo(handStart.x, handStart.y, 58, 55, handEnd.x, handEnd.y);
  330. this.g.stroke();
  331. // 画裤子
  332. var trousersStart = cc.v2(11, 73);
  333. var trousersEnd = cc.v2(33, 73);
  334. this.g.moveTo(trousersStart.x, trousersStart.y);
  335. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  336. this.g.stroke();
  337. // 画腿
  338. var legStart = cc.v2(12, 70);
  339. var legEnd = cc.v2(0, 0)
  340. this.g.moveTo(legStart.x, legStart.y);
  341. this.g.bezierCurveTo(legStart.x, legStart.y, -15, 60, legEnd.x, legEnd.y);
  342. this.g.lineTo(legEnd.x - 10, legEnd.y);
  343. this.g.stroke();
  344. legStart = cc.v2(31, 69);
  345. legEnd = cc.v2(64, 2)
  346. this.g.moveTo(legStart.x, legStart.y);
  347. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 20, legStart.y - 10, legEnd.x, legEnd.y);
  348. this.g.lineTo(legEnd.x + 10, legEnd.y);
  349. this.g.stroke();
  350. },
  351. serve_014:function() {
  352. // 画脑袋
  353. this.g.lineWidth = this.config.LINE_WIDTH;
  354. // 画手臂
  355. var handStart = cc.v2(32, 89);
  356. var handEnd = cc.v2(39, 139);
  357. this.g.lineWidth = this.config.LINE_WIDTH;
  358. this.g.moveTo(handStart.x, handStart.y);
  359. this.g.bezierCurveTo(handStart.x, handStart.y, 10, 125, handEnd.x, handEnd.y);
  360. this.g.stroke();
  361. this.g.fillColor.fromHEX('#ffffff');
  362. this.g.arc(27, 109, this.config.HEAD_SIZE, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, true);
  363. this.g.lineTo(45, 102);
  364. this.g.arc(45, 106, this.config.HEAD_SIZE, Math.PI * 1.5 - Math.PI / 12, Math.PI / 2 - Math.PI / 12, true);
  365. this.g.lineTo(27, 113);
  366. // 画个身体
  367. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  368. this.g.fillColor.fromHEX('#ffffff');
  369. this.g.circle(41, 82, this.config.BODY_SIZE);
  370. this.g.close();
  371. this.g.stroke();
  372. this.g.fill();
  373. // 画个球拍
  374. this.g.lineWidth = this.config.LINE_WIDTH;
  375. this.g.fillColor.fromHEX('#ffffff');
  376. this.g.arc(-32, 124, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 4, Math.PI * 1.5 + Math.PI / 8, true);
  377. this.g.bezierCurveTo(-31, 123, 0, 155, 40, 134);
  378. this.g.arc(42, 138, this.config.BAT_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 + Math.PI / 8, true);
  379. this.g.bezierCurveTo(45, 142, 0, 162, -37, 128);
  380. // // this.g.close();
  381. this.g.stroke();
  382. // 画手臂
  383. var handStart = cc.v2(52, 72);
  384. var handEnd = cc.v2(53, 25);
  385. this.g.lineWidth = this.config.LINE_WIDTH;
  386. this.g.moveTo(handStart.x, handStart.y);
  387. this.g.bezierCurveTo(handStart.x, handStart.y, 45, 55, handEnd.x, handEnd.y);
  388. this.g.stroke();
  389. // 画裤子
  390. var trousersStart = cc.v2(29, 78);
  391. var trousersEnd = cc.v2(51, 69);
  392. this.g.moveTo(trousersStart.x, trousersStart.y);
  393. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  394. this.g.stroke();
  395. // 画腿
  396. var legStart = cc.v2(32, 71);
  397. var legEnd = cc.v2(0, 0)
  398. this.g.moveTo(legStart.x, legStart.y);
  399. this.g.bezierCurveTo(legStart.x, legStart.y, 10, 38, legEnd.x, legEnd.y);
  400. this.g.lineTo(legEnd.x - 6, legEnd.y);
  401. this.g.stroke();
  402. legStart = cc.v2(43, 67);
  403. legEnd = cc.v2(64, 2);
  404. this.g.moveTo(legStart.x, legStart.y);
  405. this.g.bezierCurveTo(legStart.x, legStart.y, 62, 55, legEnd.x, legEnd.y);
  406. this.g.lineTo(legEnd.x + 6, legEnd.y);
  407. this.g.stroke();
  408. },
  409. serve_015:function() {
  410. // 画脑袋
  411. this.g.lineWidth = this.config.LINE_WIDTH;
  412. this.g.fillColor.fromHEX('#ffffff');
  413. // this.g.ellipse(18, 116, 15, 5);
  414. this.g.arc(53, 104, this.config.HEAD_SIZE + 1, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 8, true);
  415. this.g.lineTo(65, 96);
  416. this.g.arc(66, 101, this.config.HEAD_SIZE + 1, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  417. this.g.lineTo(49, 110);;
  418. // 画个身体
  419. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  420. this.g.fillColor.fromHEX('#ffffff');
  421. this.g.circle(54, 78, this.config.BODY_SIZE);
  422. this.g.close();
  423. this.g.stroke();
  424. this.g.fill();
  425. // 画手臂
  426. var handStart = cc.v2(45, 89);
  427. var handEnd = cc.v2(70, 135);
  428. this.g.lineWidth = this.config.LINE_WIDTH;
  429. this.g.moveTo(handStart.x, handStart.y);
  430. this.g.bezierCurveTo(handStart.x, handStart.y, 20, 128, handEnd.x, handEnd.y);
  431. this.g.stroke();
  432. // 画个球
  433. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  434. this.g.fillColor.fromHEX('#ffffff');
  435. this.g.circle(handEnd.x - 1, handEnd.y - 5, this.config.BAT_SIZE);
  436. this.g.close();
  437. this.g.stroke();
  438. this.g.fill();
  439. // 画手臂
  440. var handStart = cc.v2(55, 63);
  441. var handEnd = cc.v2(56, 30);
  442. this.g.lineWidth = this.config.LINE_WIDTH;
  443. this.g.moveTo(handStart.x, handStart.y);
  444. this.g.bezierCurveTo(handStart.x, handStart.y, 40, 40, handEnd.x, handEnd.y);
  445. // this.g.lineTo(handEnd.x, handEnd.y);
  446. this.g.stroke();
  447. // 画裤子
  448. var trousersStart = cc.v2(41, 73);
  449. var trousersEnd = cc.v2(63, 66);
  450. this.g.moveTo(trousersStart.x, trousersStart.y);
  451. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  452. this.g.stroke();
  453. // 画腿
  454. var legStart = cc.v2(44, 67);
  455. var legEnd = cc.v2(0, 0)
  456. this.g.moveTo(legStart.x, legStart.y);
  457. this.g.bezierCurveTo(legStart.x, legStart.y, 30, 52, legEnd.x, legEnd.y);
  458. this.g.lineTo(legEnd.x - 6, legEnd.y);
  459. this.g.stroke();
  460. legStart = cc.v2(57, 64);
  461. legEnd = cc.v2(63, 1)
  462. this.g.moveTo(legStart.x, legStart.y);
  463. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 40, legStart.y - 15, legEnd.x, legEnd.y);
  464. this.g.lineTo(legEnd.x + 6, legEnd.y);
  465. this.g.stroke();
  466. },
  467. serve_016:function() {
  468. // 画脑袋
  469. this.g.lineWidth = this.config.LINE_WIDTH;
  470. this.g.fillColor.fromHEX('#ffffff');
  471. // this.g.ellipse(18, 116, 15, 5);
  472. this.g.arc(70, 101, this.config.HEAD_SIZE + 1, Math.PI / 2 - Math.PI / 12, Math.PI * 1.5 - Math.PI / 8, true);
  473. this.g.lineTo(76, 92);
  474. this.g.arc(77, 97, this.config.HEAD_SIZE + 1, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  475. this.g.lineTo(71, 105);;
  476. // 画个身体
  477. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  478. this.g.fillColor.fromHEX('#ffffff');
  479. this.g.circle(64, 75, this.config.BODY_SIZE);
  480. this.g.close();
  481. this.g.stroke();
  482. this.g.fill();
  483. // 画手臂
  484. var handStart = cc.v2(60, 90);
  485. var handEnd = cc.v2(102, 107);
  486. this.g.lineWidth = this.config.LINE_WIDTH;
  487. this.g.moveTo(handStart.x, handStart.y);
  488. this.g.bezierCurveTo(handStart.x, handStart.y, 63, 140, handEnd.x, handEnd.y);
  489. this.g.stroke();
  490. // 画个球
  491. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  492. this.g.fillColor.fromHEX('#ffffff');
  493. this.g.circle(handEnd.x - 4, handEnd.y - 5, this.config.BAT_SIZE);
  494. this.g.close();
  495. this.g.stroke();
  496. this.g.fill();
  497. // 画手臂
  498. var handStart = cc.v2(64, 60);
  499. var handEnd = cc.v2(60, 33);
  500. this.g.lineWidth = this.config.LINE_WIDTH;
  501. this.g.moveTo(handStart.x, handStart.y);
  502. this.g.bezierCurveTo(handStart.x, handStart.y, 50, 40, handEnd.x, handEnd.y);
  503. // this.g.lineTo(handEnd.x, handEnd.y);
  504. this.g.stroke();
  505. // 画裤子
  506. var trousersStart = cc.v2(50, 73);
  507. var trousersEnd = cc.v2(70, 60);
  508. this.g.moveTo(trousersStart.x, trousersStart.y);
  509. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  510. this.g.stroke();
  511. // 画腿
  512. var legStart = cc.v2(52, 64);
  513. var legEnd = cc.v2(0, 0)
  514. this.g.moveTo(legStart.x, legStart.y);
  515. this.g.lineTo(legEnd.x, legEnd.y);
  516. this.g.stroke();
  517. legStart = cc.v2(68, 60);
  518. legEnd = cc.v2(63, 1)
  519. this.g.moveTo(legStart.x, legStart.y);
  520. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y);
  521. this.g.lineTo(legEnd.x + 6, legEnd.y);
  522. this.g.stroke();
  523. },
  524. serve_017:function() {
  525. // 画脑袋
  526. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  527. // 画个脑袋
  528. this.g.fillColor.fromHEX('#ffffff');
  529. this.g.circle(84, 92, this.config.HEAD_SIZE);
  530. this.g.close();
  531. this.g.stroke();
  532. this.g.fill();
  533. // 画个身体
  534. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  535. this.g.fillColor.fromHEX('#ffffff');
  536. this.g.circle(66, 73, this.config.BODY_SIZE);
  537. this.g.close();
  538. this.g.stroke();
  539. this.g.fill();
  540. // 画手臂
  541. var handStart = cc.v2(67, 88);
  542. var handEnd = cc.v2(105, 90);
  543. this.g.lineWidth = this.config.LINE_WIDTH;
  544. this.g.moveTo(handStart.x, handStart.y);
  545. this.g.bezierCurveTo(handStart.x, handStart.y, 94, 125, handEnd.x, handEnd.y);
  546. this.g.stroke();
  547. // 画个球拍
  548. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  549. this.g.fillColor.fromHEX('#ffffff');
  550. this.g.circle(handEnd.x - 4, handEnd.y - 5, this.config.BAT_SIZE);
  551. this.g.close();
  552. this.g.stroke();
  553. this.g.fill();
  554. // 画手臂
  555. var handStart = cc.v2(68, 59);
  556. var handEnd = cc.v2(60, 33);
  557. this.g.lineWidth = this.config.LINE_WIDTH;
  558. this.g.moveTo(handStart.x, handStart.y);
  559. this.g.bezierCurveTo(handStart.x, handStart.y, 50, 40, handEnd.x, handEnd.y);
  560. // this.g.lineTo(handEnd.x, handEnd.y);
  561. this.g.stroke();
  562. // 画裤子
  563. var trousersStart = cc.v2(51, 72);
  564. var trousersEnd = cc.v2(70, 60);
  565. this.g.moveTo(trousersStart.x, trousersStart.y);
  566. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  567. this.g.stroke();
  568. // 画腿
  569. var legStart = cc.v2(53, 66);
  570. var legEnd = cc.v2(0, 0)
  571. this.g.moveTo(legStart.x, legStart.y);
  572. this.g.lineTo(legEnd.x, legEnd.y);
  573. this.g.stroke();
  574. legStart = cc.v2(68, 57);
  575. legEnd = cc.v2(63, 1)
  576. this.g.moveTo(legStart.x, legStart.y);
  577. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y);
  578. this.g.lineTo(legEnd.x + 6, legEnd.y);
  579. this.g.stroke();
  580. },
  581. serve_018:function() {
  582. // 画脑袋
  583. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  584. // 画个脑袋
  585. this.g.fillColor.fromHEX('#ffffff');
  586. this.g.circle(60, 86, this.config.HEAD_SIZE);
  587. this.g.close();
  588. this.g.stroke();
  589. this.g.fill();
  590. // 画个身体
  591. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  592. this.g.fillColor.fromHEX('#ffffff');
  593. this.g.circle(43, 66, this.config.BODY_SIZE);
  594. this.g.close();
  595. this.g.stroke();
  596. this.g.fill();
  597. // 画手臂
  598. var handStart = cc.v2(37, 78);
  599. var handEnd = cc.v2(62, 110);
  600. this.g.lineWidth = this.config.LINE_WIDTH;
  601. this.g.moveTo(handStart.x, handStart.y);
  602. this.g.bezierCurveTo(handStart.x, handStart.y, 20, 120, handEnd.x, handEnd.y);
  603. this.g.stroke();
  604. // 画个球拍
  605. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  606. this.g.fillColor.fromHEX('#ffffff');
  607. this.g.circle(handEnd.x - 4, handEnd.y - 5, this.config.BAT_SIZE);
  608. this.g.close();
  609. this.g.stroke();
  610. this.g.fill();
  611. // 画手臂
  612. var handStart = cc.v2(56, 61);
  613. var handEnd = cc.v2(80, 25);
  614. this.g.lineWidth = this.config.LINE_WIDTH;
  615. this.g.moveTo(handStart.x, handStart.y);
  616. this.g.bezierCurveTo(handStart.x, handStart.y, 70, 32, handEnd.x, handEnd.y);
  617. // this.g.lineTo(handEnd.x, handEnd.y);
  618. this.g.stroke();
  619. // 画裤子
  620. var trousersStart = cc.v2(28, 61);
  621. var trousersEnd = cc.v2(53, 55);
  622. this.g.moveTo(trousersStart.x, trousersStart.y);
  623. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  624. this.g.stroke();
  625. // 画腿
  626. var legStart = cc.v2(33, 54);
  627. var legEnd = cc.v2(6, 0)
  628. this.g.moveTo(legStart.x, legStart.y);
  629. this.g.bezierCurveTo(legStart.x, legStart.y, -15, 52, legEnd.x, legEnd.y);
  630. this.g.lineTo(0, 0);
  631. this.g.stroke();
  632. legStart = cc.v2(51, 52);
  633. legEnd = cc.v2(68, 1)
  634. this.g.moveTo(legStart.x, legStart.y);
  635. this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + 38, legStart.y - 18, legEnd.x, legEnd.y);
  636. this.g.lineTo(legEnd.x + 6, legEnd.y);
  637. this.g.stroke();
  638. },
  639. serve_019:function() {
  640. // 画脑袋
  641. this.g.lineWidth = this.config.LINE_WIDTH;
  642. this.g.fillColor.fromHEX('#ffffff');
  643. // this.g.ellipse(18, 116, 15, 5);
  644. this.g.arc(37, 104, this.config.HEAD_SIZE + 2, Math.PI / 2 - Math.PI / 8, Math.PI * 1.5 - Math.PI / 8, true);
  645. this.g.lineTo(44, 96);
  646. this.g.arc(46, 101, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 - Math.PI / 8, true);
  647. this.g.lineTo(38, 110);
  648. // // this.g.close();
  649. // // this.g.stroke();
  650. // // this.g.fill();
  651. // 画个身体
  652. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  653. this.g.fillColor.fromHEX('#ffffff');
  654. this.g.circle(32, 78, this.config.BODY_SIZE);
  655. this.g.close();
  656. this.g.stroke();
  657. this.g.fill();
  658. // 画手臂
  659. var handStart = cc.v2(23, 88);
  660. var handEnd = cc.v2(-12, 127);
  661. this.g.lineWidth = this.config.LINE_WIDTH;
  662. this.g.moveTo(handStart.x, handStart.y);
  663. this.g.bezierCurveTo(handStart.x, handStart.y, -23, 95, handEnd.x, handEnd.y);
  664. this.g.stroke();
  665. // 画个球拍
  666. this.g.lineWidth = this.config.CIRCLE_WIDTH;
  667. this.g.fillColor.fromHEX('#ffffff');
  668. this.g.circle(handEnd.x + 5, handEnd.y - 1, this.config.BAT_SIZE);
  669. this.g.close();
  670. this.g.stroke();
  671. this.g.fill();
  672. // 画手臂
  673. var handStart = cc.v2(46, 81);
  674. var handEnd = cc.v2(76, 49);
  675. this.g.lineWidth = this.config.LINE_WIDTH;
  676. this.g.moveTo(handStart.x, handStart.y);
  677. this.g.bezierCurveTo(handStart.x, handStart.y, 75, 82, handEnd.x, handEnd.y);
  678. // this.g.lineTo(handEnd.x, handEnd.y);
  679. this.g.stroke();
  680. // 画裤子
  681. var trousersStart = cc.v2(19, 71);
  682. var trousersEnd = cc.v2(42, 67);
  683. this.g.moveTo(trousersStart.x, trousersStart.y);
  684. this.g.lineTo(trousersEnd.x, trousersEnd.y);
  685. this.g.stroke();
  686. // 画腿
  687. var legStart = cc.v2(22, 66);
  688. var legEnd = cc.v2(6, 0)
  689. this.g.moveTo(legStart.x, legStart.y);
  690. this.g.bezierCurveTo(legStart.x, legStart.y, -10, 52, legEnd.x, legEnd.y);
  691. this.g.lineTo(0, 0);
  692. this.g.stroke();
  693. legStart = cc.v2(38, 64);
  694. legEnd = cc.v2(68, 1)
  695. this.g.moveTo(legStart.x, legStart.y);
  696. this.g.bezierCurveTo(legStart.x, legStart.y, 65, 55, legEnd.x, legEnd.y);
  697. this.g.lineTo(legEnd.x + 6, legEnd.y);
  698. this.g.stroke();
  699. },
  700. });