Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cocos-1010
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
等吃饭
Cocos-1010
Commits
172bc42b
Commit
172bc42b
authored
May 22, 2023
by
Friends233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拖拽填入方块
parent
3086c8db
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
165 additions
and
234 deletions
+165
-234
Game.fire
assets/Scenes/Game.fire
+141
-186
block.ts
assets/Script/block.ts
+12
-14
miniBlock.ts
assets/Script/miniBlock.ts
+11
-20
block.prefab
assets/resources/prefab/block.prefab
+1
-14
No files found.
assets/Scenes/Game.fire
View file @
172bc42b
...
...
@@ -108,19 +108,19 @@
"__id__": 35
},
{
"__id__": 4
7
"__id__": 4
9
}
],
"_active": true,
"_components": [
{
"__id__": 8
4
"__id__": 8
6
},
{
"__id__": 8
5
"__id__": 8
7
},
{
"__id__": 8
6
"__id__": 8
8
}
],
"_prefab": null,
...
...
@@ -1675,22 +1675,19 @@
"__id__": 36
},
{
"__id__": 38
},
{
"__id__": 40
"__id__": 39
},
{
"__id__": 42
},
{
"__id__": 4
4
"__id__": 4
5
}
],
"_active": true,
"_components": [
{
"__id__": 4
6
"__id__": 4
8
}
],
"_prefab": null,
...
...
@@ -1753,6 +1750,9 @@
"_components": [
{
"__id__": 37
},
{
"__id__": 38
}
],
"_prefab": null,
...
...
@@ -1778,7 +1778,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-7
0
.25,
-7
3
.25,
70.25,
0,
0,
...
...
@@ -1835,6 +1835,16 @@
"_atlas": null,
"_id": "490UXZAcVFBolH9bTdJw6r"
},
{
"__type__": "b1207cbMWhNVLKTFVfAq/t2",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
},
"_enabled": true,
"_id": "a4SYzpDRhLKbA1M1ndEoSa"
},
{
"__type__": "cc.Node",
"_name": "mb",
...
...
@@ -1846,7 +1856,10 @@
"_active": true,
"_components": [
{
"__id__": 39
"__id__": 40
},
{
"__id__": 41
}
],
"_prefab": null,
...
...
@@ -1872,7 +1885,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-3
5
.25,
-3
8
.25,
70.25,
0,
0,
...
...
@@ -1902,7 +1915,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
8
"__id__": 3
9
},
"_enabled": true,
"_materials": [
...
...
@@ -1930,98 +1943,14 @@
"_id": "e8X+I+Kf9MMKUii9R4Og6A"
},
{
"__type__": "cc.Node",
"_name": "mb",
"_objFlags": 0,
"_parent": {
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 41
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 88,
"g": 217,
"b": 179,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 33.5,
"height": 33.5
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-0.25,
70.25,
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": "de4VG5iUVECaTecGJl6/WV"
},
{
"__type__": "cc.Sprite",
"__type__": "b1207cbMWhNVLKTFVfAq/t2",
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
40
"__id__":
39
},
"_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": "daTgS4oI9I+oq/JcYZ04DA"
"_id": "63a0+R6PtPZJEYz5VGpUZF"
},
{
"__type__": "cc.Node",
...
...
@@ -2035,6 +1964,9 @@
"_components": [
{
"__id__": 43
},
{
"__id__": 44
}
],
"_prefab": null,
...
...
@@ -2060,7 +1992,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
34.7
5,
-3.2
5,
70.25,
0,
0,
...
...
@@ -2083,7 +2015,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
44un+rmqtJfLnmInb/6pm8
"
"_id": "
fer+aCFxRKwYdaDkI1rASj
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -2115,7 +2047,17 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "5eXZz877tEWIoN8jw9ypNc"
"_id": "b5W6ztml5OUpbHXPnGIfOX"
},
{
"__type__": "b1207cbMWhNVLKTFVfAq/t2",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
},
"_enabled": true,
"_id": "4ecYOoNDZMP5mT5LqBUEhP"
},
{
"__type__": "cc.Node",
...
...
@@ -2128,7 +2070,10 @@
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 46
},
{
"__id__": 47
}
],
"_prefab": null,
...
...
@@ -2154,7 +2099,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
69
.75,
31
.75,
70.25,
0,
0,
...
...
@@ -2177,14 +2122,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
35XTtnZ9tMA4KldFtMw/vl
"
"_id": "
aftefayNFOAbIxQX3uji4/
"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
4
"__id__": 4
5
},
"_enabled": true,
"_materials": [
...
...
@@ -2209,7 +2154,17 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "33mc8cfdVHUIV4w/oyQdVD"
"_id": "17l0+bYu9HRY1HFZdGmn3O"
},
{
"__type__": "b1207cbMWhNVLKTFVfAq/t2",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 45
},
"_enabled": true,
"_id": "015qvGmjFBvZ4YMP/Y7Qz3"
},
{
"__type__": "005cbl0Ta1Fzqy4+w8dpg0o",
...
...
@@ -2230,25 +2185,25 @@
},
"_children": [
{
"__id__":
48
"__id__":
50
},
{
"__id__": 5
5
"__id__": 5
7
},
{
"__id__": 6
2
"__id__": 6
4
},
{
"__id__":
69
"__id__":
71
},
{
"__id__": 7
6
"__id__": 7
8
}
],
"_active": true,
"_components": [
{
"__id__": 8
3
"__id__": 8
5
}
],
"_prefab": null,
...
...
@@ -2304,17 +2259,17 @@
"_name": "next",
"_objFlags": 0,
"_parent": {
"__id__": 4
7
"__id__": 4
9
},
"_children": [
{
"__id__":
49
"__id__":
51
}
],
"_active": true,
"_components": [
{
"__id__": 5
4
"__id__": 5
6
}
],
"_prefab": null,
...
...
@@ -2370,20 +2325,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__":
48
"__id__":
50
},
"_children": [
{
"__id__": 5
0
"__id__": 5
2
}
],
"_active": true,
"_components": [
{
"__id__": 5
2
"__id__": 5
4
},
{
"__id__": 5
3
"__id__": 5
5
}
],
"_prefab": null,
...
...
@@ -2439,13 +2394,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__":
49
"__id__":
51
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 5
1
"__id__": 5
3
}
],
"_prefab": null,
...
...
@@ -2501,7 +2456,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
0
"__id__": 5
2
},
"_enabled": true,
"_materials": [
...
...
@@ -2534,7 +2489,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
49
"__id__":
51
},
"_enabled": true,
"_materials": [
...
...
@@ -2566,7 +2521,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
49
"__id__":
51
},
"_enabled": true,
"alignMode": 0,
...
...
@@ -2593,7 +2548,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
48
"__id__":
50
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -2666,7 +2621,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__":
49
"__id__":
51
},
"_id": "dfguRopclGIqZktevHrnhT"
},
...
...
@@ -2675,17 +2630,17 @@
"_name": "refreshProp",
"_objFlags": 0,
"_parent": {
"__id__": 4
7
"__id__": 4
9
},
"_children": [
{
"__id__": 5
6
"__id__": 5
8
}
],
"_active": true,
"_components": [
{
"__id__": 6
1
"__id__": 6
3
}
],
"_prefab": null,
...
...
@@ -2741,20 +2696,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 5
5
"__id__": 5
7
},
"_children": [
{
"__id__": 5
7
"__id__": 5
9
}
],
"_active": true,
"_components": [
{
"__id__":
59
"__id__":
61
},
{
"__id__": 6
0
"__id__": 6
2
}
],
"_prefab": null,
...
...
@@ -2810,13 +2765,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 5
6
"__id__": 5
8
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
58
"__id__":
60
}
],
"_prefab": null,
...
...
@@ -2872,7 +2827,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
7
"__id__": 5
9
},
"_enabled": true,
"_materials": [
...
...
@@ -2905,7 +2860,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
6
"__id__": 5
8
},
"_enabled": true,
"_materials": [
...
...
@@ -2937,7 +2892,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
6
"__id__": 5
8
},
"_enabled": true,
"alignMode": 0,
...
...
@@ -2964,7 +2919,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
5
"__id__": 5
7
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -3037,7 +2992,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 5
6
"__id__": 5
8
},
"_id": "06Xai9BG1CKLT3kEY+FESD"
},
...
...
@@ -3046,17 +3001,17 @@
"_name": "addSpeed",
"_objFlags": 0,
"_parent": {
"__id__": 4
7
"__id__": 4
9
},
"_children": [
{
"__id__": 6
3
"__id__": 6
5
}
],
"_active": true,
"_components": [
{
"__id__":
68
"__id__":
70
}
],
"_prefab": null,
...
...
@@ -3112,20 +3067,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 6
2
"__id__": 6
4
},
"_children": [
{
"__id__": 6
4
"__id__": 6
6
}
],
"_active": true,
"_components": [
{
"__id__": 6
6
"__id__": 6
8
},
{
"__id__": 6
7
"__id__": 6
9
}
],
"_prefab": null,
...
...
@@ -3181,13 +3136,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 6
3
"__id__": 6
5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
5
"__id__": 6
7
}
],
"_prefab": null,
...
...
@@ -3243,7 +3198,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
4
"__id__": 6
6
},
"_enabled": true,
"_materials": [
...
...
@@ -3276,7 +3231,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
3
"__id__": 6
5
},
"_enabled": true,
"_materials": [
...
...
@@ -3308,7 +3263,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
3
"__id__": 6
5
},
"_enabled": true,
"alignMode": 0,
...
...
@@ -3335,7 +3290,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
2
"__id__": 6
4
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -3408,7 +3363,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 6
3
"__id__": 6
5
},
"_id": "17ggxhM1pE6Lku10v0bXyS"
},
...
...
@@ -3417,17 +3372,17 @@
"_name": "init",
"_objFlags": 0,
"_parent": {
"__id__": 4
7
"__id__": 4
9
},
"_children": [
{
"__id__": 7
0
"__id__": 7
2
}
],
"_active": true,
"_components": [
{
"__id__": 7
5
"__id__": 7
7
}
],
"_prefab": null,
...
...
@@ -3483,20 +3438,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__":
69
"__id__":
71
},
"_children": [
{
"__id__": 7
1
"__id__": 7
3
}
],
"_active": true,
"_components": [
{
"__id__": 7
3
"__id__": 7
5
},
{
"__id__": 7
4
"__id__": 7
6
}
],
"_prefab": null,
...
...
@@ -3552,13 +3507,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 7
0
"__id__": 7
2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
2
"__id__": 7
4
}
],
"_prefab": null,
...
...
@@ -3614,7 +3569,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
1
"__id__": 7
3
},
"_enabled": true,
"_materials": [
...
...
@@ -3647,7 +3602,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
0
"__id__": 7
2
},
"_enabled": true,
"_materials": [
...
...
@@ -3679,7 +3634,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
0
"__id__": 7
2
},
"_enabled": true,
"alignMode": 0,
...
...
@@ -3706,7 +3661,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
69
"__id__":
71
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -3779,7 +3734,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 7
0
"__id__": 7
2
},
"_id": "57bHTVH8ZOjZpjTzCUb0mD"
},
...
...
@@ -3788,17 +3743,17 @@
"_name": "start",
"_objFlags": 0,
"_parent": {
"__id__": 4
7
"__id__": 4
9
},
"_children": [
{
"__id__": 7
7
"__id__": 7
9
}
],
"_active": true,
"_components": [
{
"__id__": 8
2
"__id__": 8
4
}
],
"_prefab": null,
...
...
@@ -3854,20 +3809,20 @@
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 7
6
"__id__": 7
8
},
"_children": [
{
"__id__":
78
"__id__":
80
}
],
"_active": true,
"_components": [
{
"__id__": 8
0
"__id__": 8
2
},
{
"__id__": 8
1
"__id__": 8
3
}
],
"_prefab": null,
...
...
@@ -3923,13 +3878,13 @@
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 7
7
"__id__": 7
9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
79
"__id__":
81
}
],
"_prefab": null,
...
...
@@ -3985,7 +3940,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
78
"__id__":
80
},
"_enabled": true,
"_materials": [
...
...
@@ -4018,7 +3973,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
7
"__id__": 7
9
},
"_enabled": true,
"_materials": [
...
...
@@ -4050,7 +4005,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
7
"__id__": 7
9
},
"_enabled": true,
"alignMode": 0,
...
...
@@ -4077,7 +4032,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
6
"__id__": 7
8
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -4150,7 +4105,7 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 7
7
"__id__": 7
9
},
"_id": "6cOXQVh5BCV4WKrcZc4zUt"
},
...
...
@@ -4159,7 +4114,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
7
"__id__": 4
9
},
"_enabled": true,
"_layoutSize": {
...
...
assets/Script/block.ts
View file @
172bc42b
...
...
@@ -31,13 +31,12 @@ export default class Block extends cc.Component {
/** 放置block */
setBlockMatrix
()
{
const
targetNodeWorldPos
=
this
.
node
.
parent
.
convertToWorldSpaceAR
(
this
.
node
.
getPosition
())
const
matrix
=
cc
.
find
(
'blockMatrix'
,
this
.
node
.
parent
.
parent
)
const
pos
=
this
.
node
.
convertToWorldSpaceAR
(
this
.
node
.
getPosition
())
const
{
targetPos
,
targetNode
}
=
this
.
posFindBlock
(
pos
)
const
{
targetPos
,
targetNode
}
=
this
.
posFindBlock
(
targetNodeWorldPos
)
this
.
isMove
=
false
const
p
=
targetNode
.
convertToNodeSpaceAR
(
cc
.
v2
(
targetPos
.
x
,
targetPos
.
y
))
console
.
log
(
'set'
,
p
.
x
,
p
.
y
)
this
.
node
.
setPosition
(
p
)
const
p
=
this
.
node
.
convertToNodeSpaceAR
(
targetPos
)
this
.
node
.
setPosition
(
cc
.
v2
(
p
.
x
+
this
.
node
.
x
,
p
.
y
+
this
.
node
.
y
))
}
/**
...
...
@@ -46,22 +45,21 @@ export default class Block extends cc.Component {
*/
posFindBlock
(
pos
:
cc
.
Vec2
)
{
const
matrix
=
cc
.
find
(
'blockMatrix'
,
this
.
node
.
parent
.
parent
)
const
matrixPos
=
matrix
.
children
.
map
((
node
)
=>
{
const
nodePos
=
node
.
convertToWorldSpaceAR
(
node
.
getPosition
())
return
{
x
:
nodePos
.
x
,
y
:
nodePos
.
y
+
300
}
})
let
minX
=
999999
,
minIdx
=
-
1
matrixPos
.
forEach
((
nodePos
:
cc
.
Vec2
,
i
)
=>
{
const
matrixPos
=
matrix
.
children
.
map
((
node
,
i
)
=>
{
const
nodePos
=
matrix
.
convertToWorldSpaceAR
(
node
.
getPosition
())
// 两点间的距离
const
offsetX
=
Math
.
sqrt
(
Math
.
pow
((
nodePos
.
x
-
pos
.
x
),
2
)
+
Math
.
pow
((
nodePos
.
y
-
pos
.
y
),
2
))
if
(
offsetX
<
minX
)
{
minX
=
offsetX
minIdx
=
i
}
return
{
nodePos
,
node
}
})
return
{
targetPos
:
matrixPos
[
minIdx
]
,
targetNode
:
matrix
.
children
[
minIdx
]
}
return
{
targetPos
:
matrixPos
[
minIdx
]
.
nodePos
,
targetNode
:
matrixPos
[
minIdx
].
node
}
}
addNodeEvent
()
{
...
...
assets/Script/miniBlock.ts
View file @
172bc42b
...
...
@@ -19,47 +19,38 @@ export default class NewClass extends cc.Component {
/** 方块矩阵外层容器 */
blockMatrix
:
cc
.
Node
=
null
/** 外层容器 */
stage
:
cc
.
Canvas
=
null
start
()
{
this
.
viewHeight
=
cc
.
view
.
getVisibleSize
().
height
this
.
viewWidth
=
cc
.
view
.
getVisibleSize
().
width
this
.
blockMatrix
=
cc
.
find
(
'blockMatrix'
,
this
.
node
.
parent
)
this
.
stage
=
this
.
node
.
parent
this
.
addNodeEvent
()
const
matrix
=
this
.
blockMatrix
=
cc
.
find
(
'blockMatrix'
,
this
.
node
.
parent
)
const
node
=
matrix
.
children
[
0
]
const
k
=
node
.
convertToWorldSpaceAR
(
node
.
getPosition
())
console
.
log
(
'start'
,
k
.
x
,
k
.
y
)
}
setBlockMatrixAll
(
parentPos
:
cc
.
Vec2
)
{
setBlockMatrixAll
()
{
this
.
isMove
=
false
const
allBlock
=
this
.
node
.
children
allBlock
.
forEach
((
node
:
cc
.
Node
)
=>
{
const
scripts
=
node
.
getComponent
(
'block'
)
scripts
.
setBlockMatrix
()
})
const
node
=
allBlock
[
0
]
const
scripts
=
node
.
getComponent
(
'block'
)
// scripts.setBlockMatrix()
}
addNodeEvent
()
{
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
()
=>
{
console
.
log
(
'TOUCH_START'
)
this
.
isMove
=
true
this
.
node
.
scale
=
1.
5
7
this
.
node
.
scale
=
1.7
},
this
)
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
()
=>
{
console
.
log
(
'TOUCH_END'
)
this
.
setBlockMatrixAll
(
this
.
node
.
getPosition
())
this
.
setBlockMatrixAll
()
},
this
)
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
e
:
cc
.
Event
.
EventTouch
)
=>
{
const
allBlock
=
this
.
node
.
children
const
matrix
=
this
.
blockMatrix
const
node
=
allBlock
[
0
]
const
blockPos
=
node
.
convertToWorldSpaceAR
(
node
.
getPosition
())
console
.
log
(
blockPos
.
x
,
blockPos
.
y
);
console
.
log
(
"========================"
)
if
(
this
.
isMove
)
{
const
pos
:
cc
.
Vec2
=
e
.
getPreviousLocation
()
...
...
assets/resources/prefab/block.prefab
View file @
172bc42b
...
...
@@ -21,13 +21,10 @@
"_components": [
{
"__id__": 2
},
{
"__id__": 3
}
],
"_prefab": {
"__id__":
4
"__id__":
3
},
"_opacity": 255,
"_color": {
...
...
@@ -108,16 +105,6 @@
"_atlas": null,
"_id": ""
},
{
"__type__": "b1207cbMWhNVLKTFVfAq/t2",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
...
...
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