123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564 |
- // 拍球的动作
- cc.Class({
- extends: cc.Component,
- properties: {
- loc: 0, // 代表方向,0为正位,1为反位
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- // 配置绘制的数据
- // 从配置中心获取数据
- this.config = require ("gameconfig")
- // 配置绘制组件
- this.g = this.getComponent(cc.Graphics);
- // 配置方向
- if (this.loc == 0) {
- this.dir = -1;
- } else {
- this.dir = 1;
- }
- // this.dir = -1;
- // this.pat_001();
- this.index = 1;
- },
- // update (dt) {},
- pat:function() {
- this.schedule(this.patUpdate, 1.0 / 15);
- },
- // 停止
- stop:function() {
- this.index = 1;
- this.unschedule(this.patUpdate);
- },
- patUpdate:function(delay) {
- this.g.clear();
- if (this.index > 7) {
- this.index = 1;
- this.unschedule(this.patUpdate);
- if (this.actionEnd != null) {
- this.actionEnd();
- }
- return;
- }
- if (this.index == 1) {
- this.pat_001();
- } else if (this.index == 2) {
- this.pat_002();
- } else if (this.index == 3) {
- this.pat_003();
- } else if (this.index == 4) {
- this.pat_004();
- } else if (this.index == 5) {
- this.pat_005();
- } else if (this.index == 6) {
- this.pat_006();
- } else if (this.index == 7) {
- this.pat_007();
- }
- this.index++;
- },
- pat_001:function() {
- // 画脑袋
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.arc(this.dir * 1, 112, this.config.HEAD_SIZE + 2, Math.PI / 2 - this.dir * Math.PI / 12, Math.PI * 1.5 - this.dir * Math.PI / 12, this.dir == 1);
- this.g.lineTo(this.dir *12, 105);
- this.g.arc(this.dir *13, 111, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - this.dir * Math.PI / 12, Math.PI / 2 - this.dir * Math.PI / 12, this.dir == 1);
- this.g.lineTo(this.dir *2, 118);
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 21, 81, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 9, 89);
- var handEnd = cc.v2(handStart.x - this.dir * 52, handStart.y + 7);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, handStart.x - this.dir * 30, handStart.y + 28, handEnd.x, handEnd.y);
- this.g.stroke();
-
- // 画个球拍
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- if (this.loc == 0) {
- this.g.arc(this.dir * -41, 105, this.config.BAT_SIZE + 2, 0 + Math.PI / 12, Math.PI + Math.PI / 12, true);
- } else {
- this.g.arc(this.dir * -41, 105, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 12, 0 - Math.PI / 12, false);
- }
- this.g.bezierCurveTo(this.dir * -37, 104, this.dir * -47, 80, this.dir * -24, 53);
- if (this.loc == 0) {
- this.g.arc(this.dir * -28, 51, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 12, Math.PI * 1.5 + Math.PI / 12, true);
- } else {
- this.g.arc(this.dir * -28, 51, this.config.BAT_SIZE + 2, 0 + Math.PI / 12, Math.PI * 1.5 - Math.PI / 12, false);
- }
- this.g.bezierCurveTo(this.dir * -30, 46, this.dir * -60, 75, this.dir * -45, 106);
- // this.g.close();
- this.g.stroke();
- // 画手臂
- var handStart = cc.v2(this.dir * 35, 84);
- var handEnd = cc.v2(this.dir * 76, 61);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 58, 55, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * 11, 73);
- var trousersEnd = cc.v2(this.dir * 33, 73);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 12, 70);
- var legEnd = cc.v2(0, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -15, 60, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x - this.dir * 10, legEnd.y);
- this.g.stroke();
- legStart = cc.v2(this.dir * 31, 69);
- legEnd = cc.v2(this.dir * 64, 2)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 20, legStart.y - 10, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x + this.dir * 10, legEnd.y);
- this.g.stroke();
- },
- pat_002:function() {
- // 画脑袋
- this.g.lineWidth = this.config.LINE_WIDTH;
- // 画手臂
- var handStart = cc.v2(this.dir * 32, 89);
- var handEnd = cc.v2(this.dir * 39, 139);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 10, 125, handEnd.x, handEnd.y);
- this.g.stroke();
- this.g.fillColor.fromHEX('#ffffff');
- this.g.arc(this.dir * 27, 109, this.config.HEAD_SIZE, Math.PI / 2 - this.dir * Math.PI / 12, Math.PI * 1.5 - this.dir * Math.PI / 12, this.dir == 1);
- this.g.lineTo(this.dir * 45, 102);
- this.g.arc(this.dir * 45, 106, this.config.HEAD_SIZE, Math.PI * 1.5 - this.dir * Math.PI / 12, Math.PI / 2 - this.dir * Math.PI / 12, this.dir == 1);
- this.g.lineTo(this.dir * 27, 113);
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 41, 82, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
-
- // 画个球拍
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- if (this.loc == 0) {
- this.g.arc(32, 124, this.config.BAT_SIZE + 2, Math.PI / 2, Math.PI * 1.5, false);
- } else {
- this.g.arc(-32, 124, this.config.BAT_SIZE + 2, Math.PI - Math.PI / 4, Math.PI * 1.5 + Math.PI / 8, true);
- }
- this.g.bezierCurveTo(this.dir * -31, 123, 0, 155, this.dir * 40, 134);
- if (this.loc == 0) {
- this.g.arc(-40, 138, this.config.BAT_SIZE + 2, Math.PI * 1.5 + Math.PI / 8, Math.PI / 2 + Math.PI / 4, false);
- } else {
- this.g.arc(42, 138, this.config.BAT_SIZE + 2, Math.PI * 1.5 - Math.PI / 8, Math.PI / 2 + Math.PI / 8, true);
- }
-
- this.g.bezierCurveTo(this.dir * 45, 142, 0, 162, this.dir * -37, 128);
- // // this.g.close();
- this.g.stroke();
- // 画手臂
- var handStart = cc.v2(this.dir * 52, 72);
- var handEnd = cc.v2(this.dir * 53, 25);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 45, 55, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * 29, 78);
- var trousersEnd = cc.v2(this.dir * 51, 69);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 32, 71);
- var legEnd = cc.v2(0, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 10, 38, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x - this.dir * 6, legEnd.y);
- this.g.stroke();
- legStart = cc.v2(this.dir * 43, 67);
- legEnd = cc.v2(this.dir * 64, 2)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 62, 55, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
- this.g.stroke();
- },
- pat_003:function() {
- // 画脑袋
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- // this.g.ellipse(18, 116, 15, 5);
- this.g.arc(this.dir * 53, 104, this.config.HEAD_SIZE + 1, Math.PI / 2 - this.dir * Math.PI / 12, Math.PI * 1.5 - this.dir * Math.PI / 8, this.dir == 1);
- this.g.lineTo(this.dir * 65, 96);
- this.g.arc(this.dir * 66, 101, this.config.HEAD_SIZE + 1, Math.PI * 1.5 - this.dir * Math.PI / 8, Math.PI / 2 - this.dir * Math.PI / 8, this.dir == 1);
- this.g.lineTo(this.dir * 49, 110);;
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 54, 78, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 45, 89);
- var handEnd = cc.v2(this.dir * 70, 135);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 20, 128, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画个球
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(handEnd.x - this.dir * 1, handEnd.y - 5, this.config.BAT_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 55, 63);
- var handEnd = cc.v2(this.dir * 56, 30);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 40, 40, handEnd.x, handEnd.y);
- // this.g.lineTo(handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * 41, 73);
- var trousersEnd = cc.v2(this.dir * 63, 66);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 44, 67);
- var legEnd = cc.v2(0, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 30, 52, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x - this.dir * 6, legEnd.y);
- this.g.stroke();
- legStart = cc.v2(this.dir * 57, 64);
- legEnd = cc.v2(this.dir * 63, 1)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 40, legStart.y - 15, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
- this.g.stroke();
- },
- pat_004:function() {
- // 画脑袋
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- // 画个脑袋
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 84, 92, this.config.HEAD_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 66, 73, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 67, 88);
- var handEnd = cc.v2(this.dir * 105, 90);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 94, 125, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画个球拍
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(handEnd.x - this.dir * 4, handEnd.y - 5, this.config.BAT_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 68, 59);
- var handEnd = cc.v2(this.dir * 60, 33);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 50, 40, handEnd.x, handEnd.y);
- // this.g.lineTo(handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * 51, 72);
- var trousersEnd = cc.v2(this.dir * 70, 60);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 53, 66);
- var legEnd = cc.v2(0, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.lineTo(legEnd.x, legEnd.y);
- this.g.stroke();
- legStart = cc.v2(this.dir * 68, 57);
- legEnd = cc.v2(this.dir * 63, 1)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 38, legStart.y - 18, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
- this.g.stroke();
- },
-
- pat_005:function() {
- // 画脑袋
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- // 画个脑袋
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 60, 86, this.config.HEAD_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 43, 66, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 37, 78);
- var handEnd = cc.v2(this.dir * 62, 110);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 20, 120, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画个球拍
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(handEnd.x - this.dir * 4, handEnd.y - 5, this.config.BAT_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 56, 61);
- var handEnd = cc.v2(this.dir * 80, 25);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 70, 32, handEnd.x, handEnd.y);
- // this.g.lineTo(handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * 28, 61);
- var trousersEnd = cc.v2(this.dir * 53, 55);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 33, 54);
- var legEnd = cc.v2(this.dir * 6, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -15, 52, legEnd.x, legEnd.y);
- this.g.lineTo(0, 0);
- this.g.stroke();
- legStart = cc.v2(this.dir * 51, 52);
- legEnd = cc.v2(this.dir * 68, 1)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, legStart.x + this.dir * 38, legStart.y - 18, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
- this.g.stroke();
- },
-
- pat_006:function() {
- // 画脑袋
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- // this.g.ellipse(18, 116, 15, 5);
- this.g.arc(this.dir * 37, 104, this.config.HEAD_SIZE + 2, Math.PI / 2 - this.dir * Math.PI / 8, Math.PI * 1.5 - this.dir * Math.PI / 8, this.dir == 1);
- this.g.lineTo(this.dir * 44, 96);
- this.g.arc(this.dir * 46, 101, this.config.HEAD_SIZE + 2, Math.PI * 1.5 - this.dir * Math.PI / 8, Math.PI / 2 - this.dir * Math.PI / 8, this.dir == 1);
- this.g.lineTo(this.dir * 38, 110);
- // // this.g.close();
- // // this.g.stroke();
- // // this.g.fill();
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 32, 78, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 23, 88);
- var handEnd = cc.v2(this.dir * -12, 127);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * -23, 95, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画个球拍
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(handEnd.x + this.dir * 5, handEnd.y - 1, this.config.BAT_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 46, 81);
- var handEnd = cc.v2(this.dir * 76, 49);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 75, 82, handEnd.x, handEnd.y);
- // this.g.lineTo(handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * 19, 71);
- var trousersEnd = cc.v2(this.dir * 42, 67);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 22, 66);
- var legEnd = cc.v2(this.dir * 6, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -10, 52, legEnd.x, legEnd.y);
- this.g.lineTo(0, 0);
- this.g.stroke();
- legStart = cc.v2(this.dir * 38, 64);
- legEnd = cc.v2(this.dir * 68, 1)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * 65, 55, legEnd.x, legEnd.y);
- this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
- this.g.stroke();
- },
-
- pat_007:function() {
- // 画脑袋
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.arc(this.dir * -4, 111.5, this.config.HEAD_SIZE, Math.PI / 2, Math.PI * 1.5, this.dir == 1);
- this.g.lineTo(this.dir * 8, 106.5);
- this.g.arc(this.dir * 7, 111.5, this.config.HEAD_SIZE, Math.PI * 1.5 , Math.PI / 2, this.dir == 1);
- this.g.lineTo(this.dir * -4, 116);
- // 画个身体
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(this.dir * 7, 87, this.config.BODY_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * -8, 87);
- var handEnd = cc.v2(this.dir * -32, 45);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * -15, 55, handEnd.x, handEnd.y);
- this.g.stroke();
- // 画个球拍
- this.g.lineWidth = this.config.CIRCLE_WIDTH;
- this.g.fillColor.fromHEX('#ffffff');
- this.g.circle(handEnd.x + this.dir * 1, handEnd.y + 6, this.config.BAT_SIZE);
- this.g.close();
- this.g.stroke();
- this.g.fill();
- // 画手臂
- var handStart = cc.v2(this.dir * 16, 99);
- var handEnd = cc.v2(this.dir * 65, 83);
- this.g.lineWidth = this.config.LINE_WIDTH;
- this.g.moveTo(handStart.x, handStart.y);
- this.g.bezierCurveTo(handStart.x, handStart.y, this.dir * 45, 110, handEnd.x, handEnd.y);
- // this.g.lineTo(handEnd.x, handEnd.y);
- this.g.stroke();
- // 画裤子
- var trousersStart = cc.v2(this.dir * -3, 75);
- var trousersEnd = cc.v2(this.dir * 23, 85);
- this.g.moveTo(trousersStart.x, trousersStart.y);
- this.g.lineTo(trousersEnd.x, trousersEnd.y);
- this.g.stroke();
- // 画腿
- var legStart = cc.v2(this.dir * 8, 72);
- var legEnd = cc.v2(0, 0)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.bezierCurveTo(legStart.x, legStart.y, this.dir * -15, 56, legEnd.x, legEnd.y);
- this.g.lineTo(this.dir * -6, 0);
- this.g.stroke();
- legStart = cc.v2(this.dir * 18, 77);
- legEnd = cc.v2(this.dir * 63, 1)
- this.g.moveTo(legStart.x, legStart.y);
- this.g.lineTo(legEnd.x, legEnd.y)
- this.g.lineTo(legEnd.x + this.dir * 6, legEnd.y);
- this.g.stroke();
- },
- });
|