Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SaveTheDoge
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Quang Sáng
SaveTheDoge
Commits
7f8d940a
Commit
7f8d940a
authored
Aug 08, 2023
by
Nguyễn Quang Sáng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8/8/2023 commit
parent
49befe32
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
1352 additions
and
946 deletions
+1352
-946
DogHurt.anim
assets/Animations/DogHurt.anim
+12
-6
Bee.prefab
assets/Prefabs/Bee.prefab
+5
-5
Dog.prefab
assets/Prefabs/Dog.prefab
+454
-0
Dog.prefab.meta
assets/Prefabs/Dog.prefab.meta
+9
-0
Lv1.prefab
assets/Prefabs/Levels/Lv1.prefab
+216
-876
gameplay.fire
assets/Scenes/gameplay.fire
+240
-2
test.fire
assets/Scenes/test.fire
+348
-32
Bee.ts
assets/Scripts/Bee.ts
+24
-12
Dog.ts
assets/Scripts/Dog.ts
+7
-0
GamePlay.ts
assets/Scripts/GamePlay.ts
+3
-1
Hole.ts
assets/Scripts/Hole.ts
+3
-4
TestCollider.ts
assets/Scripts/TestCollider.ts
+18
-0
TestCollider.ts.meta
assets/Scripts/TestCollider.ts.meta
+10
-0
TestPhysic.ts
assets/Scripts/TestPhysic.ts
+3
-8
No files found.
assets/Animations/DogHurt.anim
View file @
7f8d940a
...
@@ -3,40 +3,46 @@
...
@@ -3,40 +3,46 @@
"_name": "DogHurt",
"_name": "DogHurt",
"_objFlags": 0,
"_objFlags": 0,
"_native": "",
"_native": "",
"_duration": 1.
9
5,
"_duration": 1.5,
"sample": 60,
"sample": 60,
"speed": 1,
"speed": 1,
"wrapMode":
2
,
"wrapMode":
1
,
"curveData": {
"curveData": {
"comps": {
"comps": {
"cc.Sprite": {
"cc.Sprite": {
"spriteFrame": [
"spriteFrame": [
{
{
"frame": 0,
"frame": 0,
"value": {
"__uuid__": "4ff76bbf-c911-4902-91c9-ef49bf98c729"
}
},
{
"frame": 0.5166666666666667,
"value": {
"value": {
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
}
}
},
},
{
{
"frame": 0.
4
666666666666667,
"frame": 0.
7
666666666666667,
"value": {
"value": {
"__uuid__": "fc34febd-017d-4959-824a-5ce4fec06ef7"
"__uuid__": "fc34febd-017d-4959-824a-5ce4fec06ef7"
}
}
},
},
{
{
"frame":
0.9833333333333333
,
"frame":
1
,
"value": {
"value": {
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
}
}
},
},
{
{
"frame": 1.
4833333333333334
,
"frame": 1.
2666666666666666
,
"value": {
"value": {
"__uuid__": "fc34febd-017d-4959-824a-5ce4fec06ef7"
"__uuid__": "fc34febd-017d-4959-824a-5ce4fec06ef7"
}
}
},
},
{
{
"frame": 1.
9333333333333333
,
"frame": 1.
4833333333333334
,
"value": {
"value": {
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
"__uuid__": "38c79659-6b2e-47c5-91bf-67ad64c2df64"
}
}
...
...
assets/Prefabs/Bee.prefab
View file @
7f8d940a
...
@@ -166,9 +166,9 @@
...
@@ -166,9 +166,9 @@
},
},
"_angularVelocity": 0,
"_angularVelocity": 0,
"_fixedRotation": true,
"_fixedRotation": true,
"enabledContactListener":
fals
e,
"enabledContactListener":
tru
e,
"bullet": false,
"bullet": false,
"awakeOnLoad":
tru
e,
"awakeOnLoad":
fals
e,
"_id": ""
"_id": ""
},
},
{
{
...
@@ -179,11 +179,11 @@
...
@@ -179,11 +179,11 @@
"__id__": 1
"__id__": 1
},
},
"_enabled": true,
"_enabled": true,
"tag":
0
,
"tag":
1
,
"_density":
1
,
"_density":
0
,
"_sensor": false,
"_sensor": false,
"_friction": 0.2,
"_friction": 0.2,
"_restitution":
0
,
"_restitution":
1
,
"body": null,
"body": null,
"_offset": {
"_offset": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
...
assets/Prefabs/Dog.prefab
0 → 100644
View file @
7f8d940a
[
{
"__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
assets/Prefabs/Dog.prefab.meta
0 → 100644
View file @
7f8d940a
{
"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
assets/Prefabs/Levels/Lv1.prefab
View file @
7f8d940a
This diff is collapsed.
Click to expand it.
assets/Scenes/gameplay.fire
View file @
7f8d940a
...
@@ -82,15 +82,21 @@
...
@@ -82,15 +82,21 @@
},
},
{
{
"__id__": 12
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 16
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__": 1
3
"__id__": 1
9
},
},
{
{
"__id__":
14
"__id__":
20
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -598,6 +604,238 @@
...
@@ -598,6 +604,238 @@
"groupIndex": 0,
"groupIndex": 0,
"_id": "0760c0mvZARqBSsX2QiXWB"
"_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",
"__type__": "cc.Canvas",
"_name": "",
"_name": "",
...
...
assets/Scenes/test.fire
View file @
7f8d940a
...
@@ -78,10 +78,10 @@
...
@@ -78,10 +78,10 @@
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__":
15
"__id__":
24
},
},
{
{
"__id__":
16
"__id__":
25
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -232,7 +232,7 @@
...
@@ -232,7 +232,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "
New Node
",
"_name": "
test
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 2
"__id__": 2
...
@@ -243,12 +243,18 @@
...
@@ -243,12 +243,18 @@
},
},
{
{
"__id__": 10
"__id__": 10
},
{
"__id__": 14
},
{
"__id__": 18
}
}
],
],
"_active": true,
"_active": true,
"_components": [
"_components": [
{
{
"__id__":
14
"__id__":
23
}
}
],
],
"_prefab": null,
"_prefab": null,
...
@@ -301,7 +307,7 @@
...
@@ -301,7 +307,7 @@
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "
New Node
",
"_name": "
test
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 5
"__id__": 5
...
@@ -448,11 +454,11 @@
...
@@ -448,11 +454,11 @@
"width": 1000,
"width": 1000,
"height": 20
"height": 20
},
},
"_id": "
b9K/Yan9VMkI+rWQhVsrGt
"
"_id": "
f2jkN/3PlHVaGmzwhSacgK
"
},
},
{
{
"__type__": "cc.Node",
"__type__": "cc.Node",
"_name": "test",
"_name": "test
copy
",
"_objFlags": 0,
"_objFlags": 0,
"_parent": {
"_parent": {
"__id__": 5
"__id__": 5
...
@@ -481,8 +487,8 @@
...
@@ -481,8 +487,8 @@
},
},
"_contentSize": {
"_contentSize": {
"__type__": "cc.Size",
"__type__": "cc.Size",
"width":
2
0,
"width":
100
0,
"height":
15
0
"height":
2
0
},
},
"_anchorPoint": {
"_anchorPoint": {
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
...
@@ -493,13 +499,13 @@
...
@@ -493,13 +499,13 @@
"__type__": "TypedArray",
"__type__": "TypedArray",
"ctor": "Float64Array",
"ctor": "Float64Array",
"array": [
"array": [
24.007
,
341.745
,
238.437
,
16.825
,
0,
0,
0,
0,
0,
0,
-0.17364817766693033
,
0.7071067811865475
,
0.
984807753012208
,
0.
7071067811865476
,
1,
1,
1,
1,
1
1
...
@@ -509,14 +515,14 @@
...
@@ -509,14 +515,14 @@
"__type__": "cc.Vec3",
"__type__": "cc.Vec3",
"x": 0,
"x": 0,
"y": 0,
"y": 0,
"z":
-2
0
"z":
9
0
},
},
"_skewX": 0,
"_skewX": 0,
"_skewY": 0,
"_skewY": 0,
"_is3DNode": false,
"_is3DNode": false,
"_groupIndex": 0,
"_groupIndex": 0,
"groupIndex": 0,
"groupIndex": 0,
"_id": "
55vTzvnHpBIJn57AZzThS+
"
"_id": "
c56+nFmjJKN6MwWcxfDp7a
"
},
},
{
{
"__type__": "cc.Sprite",
"__type__": "cc.Sprite",
...
@@ -548,7 +554,7 @@
...
@@ -548,7 +554,7 @@
"_fillRange": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_isTrimmedMode": true,
"_atlas": null,
"_atlas": null,
"_id": "
3ezxTjK9JKIINZ+gHEJwpI
"
"_id": "
c0N6WvGRdLz4CeHjlyw4ud
"
},
},
{
{
"__type__": "cc.RigidBody",
"__type__": "cc.RigidBody",
...
@@ -558,9 +564,9 @@
...
@@ -558,9 +564,9 @@
"__id__": 10
"__id__": 10
},
},
"_enabled": true,
"_enabled": true,
"_type":
2
,
"_type":
1
,
"_allowSleep": false,
"_allowSleep": false,
"_gravityScale":
3
,
"_gravityScale":
0
,
"_linearDamping": 0,
"_linearDamping": 0,
"_angularDamping": 0,
"_angularDamping": 0,
"_linearVelocity": {
"_linearVelocity": {
...
@@ -569,14 +575,14 @@
...
@@ -569,14 +575,14 @@
"y": 0
"y": 0
},
},
"_angularVelocity": 0,
"_angularVelocity": 0,
"_fixedRotation":
fals
e,
"_fixedRotation":
tru
e,
"enabledContactListener": false,
"enabledContactListener": false,
"bullet": false,
"bullet": false,
"awakeOnLoad": true,
"awakeOnLoad": true,
"_id": "
0aOtl5uc9D+5f8HUl0n23C
"
"_id": "
87XSSYyXVPw5WLHXYT8FV2
"
},
},
{
{
"__type__": "cc.Physics
Polygon
Collider",
"__type__": "cc.Physics
Box
Collider",
"_name": "",
"_name": "",
"_objFlags": 0,
"_objFlags": 0,
"node": {
"node": {
...
@@ -594,29 +600,339 @@
...
@@ -594,29 +600,339 @@
"x": 0,
"x": 0,
"y": 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",
"__id__": 15
"x": -10.3,
},
"y": -74.6
{
"__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",
"__type__": "cc.Vec2",
"x":
10.1
,
"x":
-10
,
"y":
-75.2
"y":
100
},
},
{
{
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
"x":
9.9
,
"x":
-10
,
"y":
74.8
"y":
-100
},
},
{
{
"__type__": "cc.Vec2",
"__type__": "cc.Vec2",
"x":
-9.5
,
"x":
10
,
"y":
74.4
"y":
0
}
}
],
],
"_id": "
c4jw7B7cVObaXQvTmhhUtp
"
"_id": "
28OMGpZLpOjKDr+NNBfwOJ
"
},
},
{
{
"__type__": "7aaccRSHlRDIJdCgIhB/vcq",
"__type__": "7aaccRSHlRDIJdCgIhB/vcq",
...
...
assets/Scripts/Bee.ts
View file @
7f8d940a
...
@@ -6,30 +6,42 @@ const { ccclass, property } = cc._decorator;
...
@@ -6,30 +6,42 @@ const { ccclass, property } = cc._decorator;
export
default
class
Bee
extends
cc
.
Component
{
export
default
class
Bee
extends
cc
.
Component
{
static
instance
:
Bee
;
static
instance
:
Bee
;
flySpeed
:
number
=
2
00
;
flySpeed
:
number
=
1
00
;
targetPosition
:
cc
.
Vec3
=
null
;
targetPosition
:
cc
.
Node
=
null
;
flying
=
false
;
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
{
protected
onLoad
():
void
{
Bee
.
instance
=
this
;
Bee
.
instance
=
this
;
this
.
targetPosition
=
Dog
.
instance
.
node
.
position
;
this
.
node
.
active
=
true
;
}
}
protected
update
(
dt
:
number
):
void
{
protected
update
(
dt
:
number
):
void
{
this
.
timer
-=
dt
;
if
(
this
.
targetPosition
&&
this
.
flying
)
{
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
distance
=
direction
.
mag
();
let
angle
=
(
Math
.
atan2
(
direction
.
y
,
direction
.
x
)
*
180
)
/
Math
.
PI
;
let
angle
=
(
Math
.
atan2
(
direction
.
y
,
direction
.
x
)
*
180
)
/
Math
.
PI
;
this
.
node
.
angle
=
angle
;
this
.
node
.
angle
=
angle
;
if
(
distance
>
1
)
{
if
(
distance
>
1
&&
this
.
timer
<
0
)
{
let
step
=
this
.
flySpeed
*
dt
;
this
.
node
.
getComponent
(
cc
.
RigidBody
).
linearVelocity
=
this
.
velocity
;
let
newPos
=
this
.
node
.
position
.
add
(
direction
.
normalize
().
mul
(
step
));
this
.
node
.
setPosition
(
newPos
);
}
}
}
}
}
}
...
...
assets/Scripts/Dog.ts
View file @
7f8d940a
...
@@ -3,9 +3,16 @@ const { ccclass, property } = cc._decorator;
...
@@ -3,9 +3,16 @@ const { ccclass, property } = cc._decorator;
@
ccclass
@
ccclass
export
default
class
Dog
extends
cc
.
Component
{
export
default
class
Dog
extends
cc
.
Component
{
static
instance
:
Dog
;
static
instance
:
Dog
;
attacked
=
false
;
protected
onLoad
():
void
{
protected
onLoad
():
void
{
Dog
.
instance
=
this
;
Dog
.
instance
=
this
;
}
}
onBeginContact
(
contact
,
selfCollider
,
otherCollider
)
{
if
(
!
this
.
attacked
&&
otherCollider
.
tag
==
1
)
{
this
.
attacked
=
true
;
this
.
getComponent
(
cc
.
Animation
).
play
(
"DogHurt"
);
}
}
}
}
assets/Scripts/GamePlay.ts
View file @
7f8d940a
...
@@ -19,7 +19,7 @@ export default class GamePlay extends cc.Component {
...
@@ -19,7 +19,7 @@ export default class GamePlay extends cc.Component {
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getCollisionManager
().
enabled
=
true
;
cc
.
director
.
getCollisionManager
().
enabled
=
true
;
cc
.
director
.
getPhysicsManager
().
debugDrawFlags
=
1
;
//
cc.director.getPhysicsManager().debugDrawFlags = 1;
this
.
loadPrefab
();
this
.
loadPrefab
();
...
@@ -41,6 +41,7 @@ export default class GamePlay extends cc.Component {
...
@@ -41,6 +41,7 @@ export default class GamePlay extends cc.Component {
this
.
rb
=
this
.
draw
.
addComponent
(
cc
.
RigidBody
);
this
.
rb
=
this
.
draw
.
addComponent
(
cc
.
RigidBody
);
this
.
rb
.
type
=
cc
.
RigidBodyType
.
Static
;
this
.
rb
.
type
=
cc
.
RigidBodyType
.
Static
;
this
.
chain
=
this
.
draw
.
addComponent
(
cc
.
PhysicsChainCollider
);
this
.
chain
=
this
.
draw
.
addComponent
(
cc
.
PhysicsChainCollider
);
this
.
chain
.
points
=
[
event
.
getLocation
()];
this
.
chain
.
points
=
[
event
.
getLocation
()];
}
}
...
@@ -56,6 +57,7 @@ export default class GamePlay extends cc.Component {
...
@@ -56,6 +57,7 @@ export default class GamePlay extends cc.Component {
// this.isDrawing = false;
// this.isDrawing = false;
// this.rb.type = cc.RigidBodyType.Dynamic;
// this.rb.type = cc.RigidBodyType.Dynamic;
this
.
rb
.
allowSleep
=
false
;
this
.
rb
.
allowSleep
=
false
;
this
.
rb
.
enabledContactListener
=
true
;
Dog
.
instance
.
getComponent
(
cc
.
Animation
).
play
(
"DogScare"
);
Dog
.
instance
.
getComponent
(
cc
.
Animation
).
play
(
"DogScare"
);
this
.
chain
.
apply
();
this
.
chain
.
apply
();
Hole
.
instance
.
isSpawnable
=
true
;
Hole
.
instance
.
isSpawnable
=
true
;
...
...
assets/Scripts/Hole.ts
View file @
7f8d940a
...
@@ -5,7 +5,7 @@ const { ccclass, property } = cc._decorator;
...
@@ -5,7 +5,7 @@ const { ccclass, property } = cc._decorator;
@
ccclass
@
ccclass
export
default
class
Hole
extends
cc
.
Component
{
export
default
class
Hole
extends
cc
.
Component
{
static
instance
:
Hole
;
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
.
Float
)
refreshTimer
:
number
=
0.5
;
@
property
(
cc
.
Node
)
dog
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
dog
:
cc
.
Node
=
null
;
...
@@ -18,7 +18,7 @@ export default class Hole extends cc.Component {
...
@@ -18,7 +18,7 @@ export default class Hole extends cc.Component {
if
(
!
this
.
isSpawnable
)
return
;
if
(
!
this
.
isSpawnable
)
return
;
if
(
this
.
timer
>
0
)
return
;
if
(
this
.
timer
>
0
)
return
;
if
(
this
.
currentBeeAmount
>=
this
.
beeAmount
)
return
;
if
(
this
.
currentBeeAmount
>=
this
.
beeAmount
)
return
;
this
.
timer
=
this
.
refreshTimer
;
this
.
timer
=
this
.
refreshTimer
;
var
bee
=
cc
.
instantiate
(
this
.
beePrefab
);
var
bee
=
cc
.
instantiate
(
this
.
beePrefab
);
let
nodeWorldPosition
=
this
.
node
.
convertToWorldSpaceAR
(
cc
.
Vec2
.
ZERO
);
let
nodeWorldPosition
=
this
.
node
.
convertToWorldSpaceAR
(
cc
.
Vec2
.
ZERO
);
...
@@ -26,10 +26,9 @@ export default class Hole extends cc.Component {
...
@@ -26,10 +26,9 @@ export default class Hole extends cc.Component {
this
.
node
.
parent
.
parent
.
convertToNodeSpaceAR
(
nodeWorldPosition
);
this
.
node
.
parent
.
parent
.
convertToNodeSpaceAR
(
nodeWorldPosition
);
bee
.
parent
=
this
.
node
.
parent
.
parent
;
bee
.
parent
=
this
.
node
.
parent
.
parent
;
bee
.
position
=
cc
.
v3
(
nodeCanvasPosition
.
x
,
nodeCanvasPosition
.
y
);
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
();
bee
.
getComponent
(
Bee
).
fly
();
this
.
currentBeeAmount
++
;
this
.
currentBeeAmount
++
;
// bee.getComponent(cc.RigidBody).linearVelocity = velocity
}
}
protected
update
(
dt
:
number
):
void
{
protected
update
(
dt
:
number
):
void
{
...
...
assets/Scripts/TestCollider.ts
0 → 100644
View file @
7f8d940a
// 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
;
}
}
assets/Scripts/TestCollider.ts.meta
0 → 100644
View file @
7f8d940a
{
"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
assets/Scripts/TestPhysic.ts
View file @
7f8d940a
// 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
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
export
default
class
TestPhysic
extends
cc
.
Component
{
protected
onLoad
():
void
{
protected
onLoad
():
void
{
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getPhysicsManager
().
enabled
=
true
;
cc
.
director
.
getCollisionManager
().
enabled
=
true
;
cc
.
director
.
getCollisionManager
().
enabled
=
true
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment