Commit 798d5fc9 by 李楚霏

调整

parent d9acf969
{
"ver": "1.0.1",
"uuid": "18385179-89a5-4061-a71b-590b217dbdd5",
"isSubpackage": false,
"subpackageName": "",
"subMetas": {}
}
\ No newline at end of file
xiaojiejie.png
size: 1024,256
format: RGBA8888
filter: Linear,Linear
repeat: none
bizi1
rotate: false
xy: 448, 2
size: 17, 12
orig: 19, 14
offset: 1, 1
index: -1
meimao1
rotate: false
xy: 226, 9
size: 107, 35
orig: 109, 37
offset: 1, 1
index: -1
meimao2
rotate: false
xy: 562, 87
size: 115, 44
orig: 117, 46
offset: 1, 1
index: -1
shenzi
rotate: true
xy: 655, 153
size: 100, 182
orig: 101, 182
offset: 0, 0
index: -1
tou
rotate: false
xy: 226, 46
size: 177, 207
orig: 179, 209
offset: 1, 1
index: -1
toufa1
rotate: true
xy: 2, 12
size: 241, 222
orig: 243, 224
offset: 1, 1
index: -1
toufa2
rotate: true
xy: 405, 133
size: 120, 248
orig: 122, 250
offset: 1, 1
index: -1
yanjing1
rotate: false
xy: 643, 7
size: 127, 56
orig: 129, 58
offset: 1, 1
index: -1
yanjing2
rotate: false
xy: 335, 13
size: 111, 31
orig: 113, 33
offset: 1, 1
index: -1
yanlei
rotate: false
xy: 729, 72
size: 96, 59
orig: 98, 61
offset: 1, 1
index: -1
yinying
rotate: false
xy: 405, 82
size: 155, 49
orig: 157, 51
offset: 1, 1
index: -1
youjiao1
rotate: true
xy: 655, 133
size: 18, 62
orig: 20, 64
offset: 1, 1
index: -1
youjiao2
rotate: false
xy: 772, 17
size: 32, 53
orig: 34, 55
offset: 1, 1
index: -1
youjiaoxie
rotate: true
xy: 603, 4
size: 48, 38
orig: 50, 40
offset: 1, 1
index: -1
youshou1
rotate: true
xy: 638, 65
size: 20, 81
orig: 21, 82
offset: 1, 0
index: -1
youshou2
rotate: true
xy: 448, 16
size: 28, 87
orig: 30, 89
offset: 1, 1
index: -1
zui1
rotate: false
xy: 574, 54
size: 62, 31
orig: 64, 33
offset: 1, 1
index: -1
zui2
rotate: false
xy: 537, 7
size: 64, 44
orig: 66, 46
offset: 1, 1
index: -1
zuojiao1
rotate: true
xy: 719, 133
size: 18, 62
orig: 20, 64
offset: 1, 1
index: -1
zuojiao2
rotate: false
xy: 806, 17
size: 32, 53
orig: 34, 55
offset: 1, 1
index: -1
zuojiaoxie
rotate: false
xy: 679, 93
size: 48, 38
orig: 50, 40
offset: 1, 1
index: -1
zuoshou1
rotate: true
xy: 405, 46
size: 34, 82
orig: 35, 82
offset: 1, 0
index: -1
zuoshou2
rotate: true
xy: 489, 53
size: 27, 83
orig: 29, 85
offset: 1, 1
index: -1
{
"ver": "1.0.1",
"uuid": "e565075a-88d3-4a0f-994c-33259aa3b2c9",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.2.3",
"uuid": "20fe5dfa-313f-4ffd-aa15-e4a98e798833",
"textures": [
"4ef7bbdd-bf74-480c-8a33-cb87e948e47c"
],
"scale": 1,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "4ef7bbdd-bf74-480c-8a33-cb87e948e47c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 256,
"platformSettings": {},
"subMetas": {
"xiaojiejie": {
"ver": "1.0.4",
"uuid": "8d2b0f40-687b-45dd-8e23-c5d87eb6ca25",
"rawTextureUuid": "4ef7bbdd-bf74-480c-8a33-cb87e948e47c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -92,
"offsetY": 0.5,
"trimX": 2,
"trimY": 2,
"width": 836,
"height": 251,
"rawWidth": 1024,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.4",
"uuid": "f17f9876-23f1-41cd-9a59-67d91c97a278",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 149,
"height": 154,
"platformSettings": {},
"subMetas": {
"disk2": {
"ver": "1.0.4",
"uuid": "3d476a7a-44ff-4fb2-bc15-c4c20ff68f4f",
"rawTextureUuid": "f17f9876-23f1-41cd-9a59-67d91c97a278",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 149,
"height": 154,
"rawWidth": 149,
"rawHeight": 154,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
rigidBody: cc.RigidBody;
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.rigidBody = this.node.getComponent(cc.RigidBody);
this.rigidBody.type = cc.RigidBodyType.Dynamic;
}
start () {
}
// update (dt) {
// this.rigidBody.angularVelocity = 100;
// }
}
{
"ver": "1.0.8",
"uuid": "5df46d72-14a7-4ab8-ba97-9062defbcd52",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ export default class NewClass extends cc.Component {
motor: cc.MotorJoint;
collider: cc.PhysicsPolygonCollider;
startPoint: cc.Vec2;
tween: any;
// LIFE-CYCLE CALLBACKS:
onPreSolve(contact, selfCollider, otherCollider) {
......@@ -92,12 +93,16 @@ export default class NewClass extends cc.Component {
move(dir) {
console.error('move');
this.node.position = dir;
this.tween = cc.tween(this.node)
.to(1, {position: dir})
.start()
// this.node.position = dir;
// this.rigidBody.awake = true;
cc.director.getPhysicsManager().enabled = false;
}
moveEnd() {
console.error('moveEnd');
this.tween.stop();
cc.director.getPhysicsManager().enabled = true;
}
......
......@@ -17,33 +17,34 @@ export default class NewClass extends cc.Component {
text: string = 'hello';
startPoint: any;
rigidBody: any;
tween: any;
// LIFE-CYCLE CALLBACKS:
onPreSolve(contact, selfCollider, otherCollider) {
// console.error(otherCollider.node.name);
// if (otherCollider && otherCollider.node.getComponent(cc.MotorJoint)) {
// // this.rigidBody.awake = false;
// console.error(selfCollider.name);
// otherCollider.node.addComponent(cc.MotorJoint);
// const motor = otherCollider.node.getComponent(cc.MotorJoint);
// motor.connectedBody = this.node;
// motor.maxTorque = -200;
// }
// const motorJoint =this.node.getComponent(cc.MotorJoint);
// motorJoint.connectedBody = otherCollider.node;
// console.error(motorJoint.connectedBody.name);
if (otherCollider.node.name.includes('staticGear')) {
this.rigidBody.angularVelocity = - otherCollider.node.getComponent(cc.RigidBody).angularVelocity;
if (otherCollider.node.name.includes('disk')) {
this.moveEnd();
this.scheduleOnce(()=>{
console.error('1');
this.rigidBody.type = cc.RigidBodyType.Dynamic;
otherCollider.node.getComponent(cc.RigidBody).type = cc.RigidBodyType.Kinematic;
const joint = this.node.getComponent(cc.WeldJoint);
joint.enabled =true;
joint.connectedBody = otherCollider.node;
})
// joint.anchor = cc.v2(-51.7, -1.1);
}
}
onPostSolve(contact, selfCollider, otherCollider) {
this.rigidBody.angularVelocity = 0;
this.scheduleOnce(()=>{
this.rigidBody.type = cc.RigidBodyType.Kinematic;
otherCollider.node.getComponent(cc.RigidBody).type = cc.RigidBodyType.Dynamic;
})
}
onLoad () {
this.rigidBody = this.node.getComponent(cc.RigidBody);
this.rigidBody.type = cc.RigidBodyType.Kinematic;
this.initEvent();
}
......@@ -55,7 +56,7 @@ export default class NewClass extends cc.Component {
}
_touchStartEvent(event: cc.Event.EventTouch) {
this.startPoint = event.getStartLocation();
this.startPoint = event.getPreviousLocation();
}
_touchMoveEvent(event: cc.Event.EventTouch) {
// this.points.push(event.getLocation());
......@@ -87,13 +88,17 @@ export default class NewClass extends cc.Component {
}
move(dir) {
console.error('move');
this.node.position = dir;
// this.node.position = dir;
this.tween = cc.tween(this.node)
.to(0.7, {position: dir})
.start()
// this.rigidBody.awake = true;
// cc.director.getPhysicsManager().enabled = false;
}
moveEnd() {
console.error('moveEnd');
if (this.tween) {
this.tween.stop();
}
// cc.director.getPhysicsManager().enabled = true;
}
......@@ -102,5 +107,6 @@ export default class NewClass extends cc.Component {
}
// update (dt) {}
// update (dt) {
// }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment