peel.js 19 KB

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