Commit 7f8d940a authored by Nguyễn Quang Sáng's avatar Nguyễn Quang Sáng

8/8/2023 commit

parent 49befe32
......@@ -3,40 +3,46 @@
"_name": "DogHurt",
"_objFlags": 0,
"_native": "",
"_duration": 1.95,
"_duration": 1.5,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"wrapMode": 1,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "4ff76bbf-c911-4902-91c9-ef49bf98c729"
}
},
{
"frame": 0.5166666666666667,
"value": {
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
}
},
{
"frame": 0.4666666666666667,
"frame": 0.7666666666666667,
"value": {
"__uuid__": "fc34febd-017d-4959-824a-5ce4fec06ef7"
}
},
{
"frame": 0.9833333333333333,
"frame": 1,
"value": {
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
}
},
{
"frame": 1.4833333333333334,
"frame": 1.2666666666666666,
"value": {
"__uuid__": "fc34febd-017d-4959-824a-5ce4fec06ef7"
}
},
{
"frame": 1.9333333333333333,
"frame": 1.4833333333333334,
"value": {
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
}
......
......@@ -166,9 +166,9 @@
},
"_angularVelocity": 0,
"_fixedRotation": true,
"enabledContactListener": false,
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"awakeOnLoad": false,
"_id": ""
},
{
......@@ -179,11 +179,11 @@
"__id__": 1
},
"_enabled": true,
"tag": 0,
"_density": 1,
"tag": 1,
"_density": 0,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"_restitution": 1,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
......
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "Dog",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
},
{
"__id__": 4
},
{
"__id__": 5
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 98,
"height": 99
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
517.374,
271.798,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "fa88432e-2413-4fb7-8239-25cbf06c5dec"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "66c0dT0+4VDrr9JdiNMsqQf",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "290ab410-a8d5-48d8-823a-18a941908c17"
},
"_clips": [
{
"__uuid__": "290ab410-a8d5-48d8-823a-18a941908c17"
},
{
"__uuid__": "e912ae40-0d1e-48f8-8d19-83f8d215dbd4"
},
{
"__uuid__": "b8789b21-46a2-4096-b3f3-87e769faf7db"
}
],
"playOnLoad": true,
"_id": ""
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_type": 2,
"_allowSleep": false,
"_gravityScale": 2,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": ""
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"tag": 2,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0.3,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": -32.2,
"y": -41.1
},
{
"__type__": "cc.Vec2",
"x": -25.04,
"y": -44.66
},
{
"__type__": "cc.Vec2",
"x": -16.5,
"y": -47.1
},
{
"__type__": "cc.Vec2",
"x": -5.62,
"y": -48.06
},
{
"__type__": "cc.Vec2",
"x": 3.3,
"y": -48.2
},
{
"__type__": "cc.Vec2",
"x": 19.24,
"y": -46.26
},
{
"__type__": "cc.Vec2",
"x": 26.51,
"y": -43.12
},
{
"__type__": "cc.Vec2",
"x": 34.26,
"y": -39.11
},
{
"__type__": "cc.Vec2",
"x": 42.36,
"y": -31.25
},
{
"__type__": "cc.Vec2",
"x": 46.2,
"y": -22.4
},
{
"__type__": "cc.Vec2",
"x": 48.49,
"y": -15.08
},
{
"__type__": "cc.Vec2",
"x": 48.34,
"y": -6.76
},
{
"__type__": "cc.Vec2",
"x": 47.87,
"y": -2.82
},
{
"__type__": "cc.Vec2",
"x": 45.9,
"y": 7.3
},
{
"__type__": "cc.Vec2",
"x": 42.29,
"y": 14.58
},
{
"__type__": "cc.Vec2",
"x": 38.12,
"y": 20.79
},
{
"__type__": "cc.Vec2",
"x": 37.99,
"y": 27.46
},
{
"__type__": "cc.Vec2",
"x": 37.57,
"y": 30.11
},
{
"__type__": "cc.Vec2",
"x": 36.94,
"y": 33.97
},
{
"__type__": "cc.Vec2",
"x": 35.51,
"y": 39.26
},
{
"__type__": "cc.Vec2",
"x": 34.76,
"y": 40.85
},
{
"__type__": "cc.Vec2",
"x": 33.94,
"y": 42.84
},
{
"__type__": "cc.Vec2",
"x": 32.07,
"y": 45.69
},
{
"__type__": "cc.Vec2",
"x": 30.45,
"y": 47.38
},
{
"__type__": "cc.Vec2",
"x": 25.48,
"y": 48.57
},
{
"__type__": "cc.Vec2",
"x": 20.48,
"y": 44.11
},
{
"__type__": "cc.Vec2",
"x": 13.72,
"y": 36.36
},
{
"__type__": "cc.Vec2",
"x": 7.8,
"y": 37.9
},
{
"__type__": "cc.Vec2",
"x": -0.17,
"y": 37.85
},
{
"__type__": "cc.Vec2",
"x": -7.89,
"y": 37.78
},
{
"__type__": "cc.Vec2",
"x": -11.21,
"y": 37.36
},
{
"__type__": "cc.Vec2",
"x": -13.35,
"y": 36.9
},
{
"__type__": "cc.Vec2",
"x": -15.6,
"y": 39.9
},
{
"__type__": "cc.Vec2",
"x": -19.06,
"y": 43.19
},
{
"__type__": "cc.Vec2",
"x": -22.76,
"y": 45.53
},
{
"__type__": "cc.Vec2",
"x": -25.01,
"y": 46.55
},
{
"__type__": "cc.Vec2",
"x": -29.81,
"y": 45.02
},
{
"__type__": "cc.Vec2",
"x": -33.36,
"y": 40.01
},
{
"__type__": "cc.Vec2",
"x": -34.31,
"y": 34.26
},
{
"__type__": "cc.Vec2",
"x": -35.75,
"y": 27.56
},
{
"__type__": "cc.Vec2",
"x": -35.75,
"y": 23.91
},
{
"__type__": "cc.Vec2",
"x": -40.6,
"y": 18.35
},
{
"__type__": "cc.Vec2",
"x": -44.05,
"y": 12.1
},
{
"__type__": "cc.Vec2",
"x": -46.9,
"y": 3.9
},
{
"__type__": "cc.Vec2",
"x": -47.59,
"y": -6.53
},
{
"__type__": "cc.Vec2",
"x": -47.3,
"y": -18.6
},
{
"__type__": "cc.Vec2",
"x": -43.69,
"y": -28.28
},
{
"__type__": "cc.Vec2",
"x": -37.53,
"y": -35.53
}
],
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.3.2",
"uuid": "e8c2cf5b-fc60-4e50-891e-a744730cceb6",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
......@@ -82,15 +82,21 @@
},
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 16
}
],
"_active": true,
"_components": [
{
"__id__": 13
"__id__": 19
},
{
"__id__": 14
"__id__": 20
}
],
"_prefab": null,
......@@ -598,6 +604,238 @@
"groupIndex": 0,
"_id": "0760c0mvZARqBSsX2QiXWB"
},
{
"__type__": "cc.Node",
"_name": "Wall",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 15
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50,
"height": 960
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-345,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "24fesSE41FJqsVxBlcr2NV"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"_type": 0,
"_allowSleep": false,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": true,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "e5qgEr1xJJ2ZPi+SOFl1a0"
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 50,
"height": 960
},
"_id": "21TPr2nFJNX7/Oq6xXnU4I"
},
{
"__type__": "cc.Node",
"_name": "Wall",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
},
{
"__id__": 18
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50,
"height": 960
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
345,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "10O1N4cuJIf7t7JabcuW05"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_type": 0,
"_allowSleep": false,
"_gravityScale": 1,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": true,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "7dfggALVRB2LUTC1fkM6kd"
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 50,
"height": 960
},
"_id": "1fodx682pO5YZpZbQX/Kaa"
},
{
"__type__": "cc.Canvas",
"_name": "",
......
......@@ -78,10 +78,10 @@
"_active": true,
"_components": [
{
"__id__": 15
"__id__": 24
},
{
"__id__": 16
"__id__": 25
}
],
"_prefab": null,
......@@ -232,7 +232,7 @@
},
{
"__type__": "cc.Node",
"_name": "New Node",
"_name": "test",
"_objFlags": 0,
"_parent": {
"__id__": 2
......@@ -243,12 +243,18 @@
},
{
"__id__": 10
},
{
"__id__": 14
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 14
"__id__": 23
}
],
"_prefab": null,
......@@ -301,7 +307,7 @@
},
{
"__type__": "cc.Node",
"_name": "New Node",
"_name": "test",
"_objFlags": 0,
"_parent": {
"__id__": 5
......@@ -448,11 +454,11 @@
"width": 1000,
"height": 20
},
"_id": "b9K/Yan9VMkI+rWQhVsrGt"
"_id": "f2jkN/3PlHVaGmzwhSacgK"
},
{
"__type__": "cc.Node",
"_name": "test",
"_name": "test copy",
"_objFlags": 0,
"_parent": {
"__id__": 5
......@@ -481,8 +487,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 20,
"height": 150
"width": 1000,
"height": 20
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -493,13 +499,13 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
24.007,
238.437,
341.745,
16.825,
0,
0,
0,
-0.17364817766693033,
0.984807753012208,
0.7071067811865475,
0.7071067811865476,
1,
1,
1
......@@ -509,14 +515,14 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -20
"z": 90
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "55vTzvnHpBIJn57AZzThS+"
"_id": "c56+nFmjJKN6MwWcxfDp7a"
},
{
"__type__": "cc.Sprite",
......@@ -548,7 +554,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "3ezxTjK9JKIINZ+gHEJwpI"
"_id": "c0N6WvGRdLz4CeHjlyw4ud"
},
{
"__type__": "cc.RigidBody",
......@@ -558,9 +564,9 @@
"__id__": 10
},
"_enabled": true,
"_type": 2,
"_type": 1,
"_allowSleep": false,
"_gravityScale": 3,
"_gravityScale": 0,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
......@@ -569,14 +575,14 @@
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": false,
"_fixedRotation": true,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "0aOtl5uc9D+5f8HUl0n23C"
"_id": "87XSSYyXVPw5WLHXYT8FV2"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
......@@ -594,29 +600,339 @@
"x": 0,
"y": 0
},
"points": [
"_size": {
"__type__": "cc.Size",
"width": 1000,
"height": 20
},
"_id": "96lKzIM9JFX4SArA5/d0F7"
},
{
"__type__": "cc.Node",
"_name": "test copy",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [],
"_active": true,
"_components": [
{
"__type__": "cc.Vec2",
"x": -10.3,
"y": -74.6
"__id__": 15
},
{
"__id__": 16
},
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1000,
"height": 20
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-298.303,
16.825,
0,
0,
0,
0.7071067811865475,
0.7071067811865476,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 90
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "74ASph+U5CxJJDFxPzOmkn"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "5d+84y1DdGw7O4TFOqCLoI"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_type": 1,
"_allowSleep": false,
"_gravityScale": 0,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_angularVelocity": 0,
"_fixedRotation": true,
"enabledContactListener": false,
"bullet": false,
"awakeOnLoad": true,
"_id": "76ICVX6EJMoJ30DoqViau/"
},
{
"__type__": "cc.PhysicsBoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 0,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 1000,
"height": 20
},
"_id": "6cUsCS+htM9pa6oVaR3I5m"
},
{
"__type__": "cc.Node",
"_name": "test",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
},
{
"__id__": 20
},
{
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 20,
"height": 200
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1.405,
368.808,
0,
0,
0,
-0.16010515768843164,
0.9870999637734582,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -18.426000000000002
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "50EUui8txFdpfAqkzmjuiO"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "1blZSzOTBDLpsUXHSpUmEa"
},
{
"__type__": "cc.RigidBody",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_type": 2,
"_allowSleep": false,
"_gravityScale": 0,
"_linearDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 100
},
"_angularVelocity": 0,
"_fixedRotation": false,
"enabledContactListener": true,
"bullet": false,
"awakeOnLoad": true,
"_id": "1cfiKhRzdA2Kqp7y/p6c68"
},
{
"__type__": "1a526ERoNlBJ4QDHV+iifGH",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_id": "dbIEDAURxEga5FLJd0fT5J"
},
{
"__type__": "cc.PhysicsPolygonCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"tag": 0,
"_density": 1,
"_sensor": false,
"_friction": 0.2,
"_restitution": 1,
"body": null,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"points": [
{
"__type__": "cc.Vec2",
"x": 10.1,
"y": -75.2
"x": -10,
"y": 100
},
{
"__type__": "cc.Vec2",
"x": 9.9,
"y": 74.8
"x": -10,
"y": -100
},
{
"__type__": "cc.Vec2",
"x": -9.5,
"y": 74.4
"x": 10,
"y": 0
}
],
"_id": "c4jw7B7cVObaXQvTmhhUtp"
"_id": "28OMGpZLpOjKDr+NNBfwOJ"
},
{
"__type__": "7aaccRSHlRDIJdCgIhB/vcq",
......
......@@ -6,30 +6,42 @@ const { ccclass, property } = cc._decorator;
export default class Bee extends cc.Component {
static instance: Bee;
flySpeed: number = 200;
targetPosition: cc.Vec3 = null;
flySpeed: number = 100;
targetPosition: cc.Node = null;
flying = false;
timer: number = 0;
velocity: cc.Vec2 = cc.v2(0, 0);
onBeginContact(contact, selfCollider, otherCollider) {
if (otherCollider.tag == 0) {
this.node.getComponent(cc.RigidBody).linearVelocity = cc.v2(
this.velocity.x - 50,
this.velocity.y - 50
);
this.timer = 0.3;
}
}
protected onLoad(): void {
Bee.instance = this;
this.targetPosition = Dog.instance.node.position;
this.node.active = true;
}
protected update(dt: number): void {
this.timer -= dt;
if (this.targetPosition && this.flying) {
let direction = this.targetPosition.sub(this.node.position);
var deltaX = this.targetPosition.x - this.node.x;
var deltaY = this.targetPosition.y - this.node.y;
var direction = cc.v3(deltaX, deltaY);
this.velocity = cc.v2(
direction.x * dt * this.flySpeed,
direction.y * dt * this.flySpeed
);
let distance = direction.mag();
let angle = (Math.atan2(direction.y, direction.x) * 180) / Math.PI;
this.node.angle = angle;
if (distance > 1) {
let step = this.flySpeed * dt;
let newPos = this.node.position.add(direction.normalize().mul(step));
this.node.setPosition(newPos);
if (distance > 1 && this.timer < 0) {
this.node.getComponent(cc.RigidBody).linearVelocity = this.velocity;
}
}
}
......
......@@ -3,9 +3,16 @@ const { ccclass, property } = cc._decorator;
@ccclass
export default class Dog extends cc.Component {
static instance: Dog;
attacked = false;
protected onLoad(): void {
Dog.instance = this;
}
onBeginContact(contact, selfCollider, otherCollider) {
if (!this.attacked && otherCollider.tag == 1) {
this.attacked = true;
this.getComponent(cc.Animation).play("DogHurt");
}
}
}
......@@ -19,7 +19,7 @@ export default class GamePlay extends cc.Component {
cc.director.getPhysicsManager().enabled = true;
cc.director.getCollisionManager().enabled = true;
cc.director.getPhysicsManager().debugDrawFlags = 1;
// cc.director.getPhysicsManager().debugDrawFlags = 1;
this.loadPrefab();
......@@ -41,6 +41,7 @@ export default class GamePlay extends cc.Component {
this.rb = this.draw.addComponent(cc.RigidBody);
this.rb.type = cc.RigidBodyType.Static;
this.chain = this.draw.addComponent(cc.PhysicsChainCollider);
this.chain.points = [event.getLocation()];
}
......@@ -56,6 +57,7 @@ export default class GamePlay extends cc.Component {
// this.isDrawing = false;
// this.rb.type = cc.RigidBodyType.Dynamic;
this.rb.allowSleep = false;
this.rb.enabledContactListener = true;
Dog.instance.getComponent(cc.Animation).play("DogScare");
this.chain.apply();
Hole.instance.isSpawnable = true;
......
......@@ -5,7 +5,7 @@ const { ccclass, property } = cc._decorator;
@ccclass
export default class Hole extends cc.Component {
static instance: Hole;
@property(cc.Prefab) private beePrefab: cc.Prefab = null;
@property(cc.Prefab) beePrefab: cc.Prefab = null;
@property(cc.Float) refreshTimer: number = 0.5;
@property(cc.Node) dog: cc.Node = null;
......@@ -18,7 +18,7 @@ export default class Hole extends cc.Component {
if (!this.isSpawnable) return;
if (this.timer > 0) return;
if (this.currentBeeAmount >= this.beeAmount) return;
this.timer = this.refreshTimer;
var bee = cc.instantiate(this.beePrefab);
let nodeWorldPosition = this.node.convertToWorldSpaceAR(cc.Vec2.ZERO);
......@@ -26,10 +26,9 @@ export default class Hole extends cc.Component {
this.node.parent.parent.convertToNodeSpaceAR(nodeWorldPosition);
bee.parent = this.node.parent.parent;
bee.position = cc.v3(nodeCanvasPosition.x, nodeCanvasPosition.y);
bee.getComponent(Bee).targetPosition = this.dog.position;
bee.getComponent(Bee).targetPosition = this.dog;
bee.getComponent(Bee).fly();
this.currentBeeAmount++;
// bee.getComponent(cc.RigidBody).linearVelocity = velocity
}
protected update(dt: number): void {
......
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
onBeginContact(contact: cc.PhysicsContact, selfCollider, otherCollider) {
console.log("contact", contact);
}
protected update(dt: number): void {
this.node.y -= 5;
}
}
{
"ver": "1.1.0",
"uuid": "1a526111-a0d9-4127-8403-1d5fa289f187",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
export default class TestPhysic extends cc.Component {
protected onLoad(): void {
cc.director.getPhysicsManager().enabled = true;
cc.director.getCollisionManager().enabled = true;
}
}
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 to comment