peel.js 19 KB

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