serve.js 28 KB

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