This commit is contained in:
richarjiang
2025-09-19 17:21:53 +08:00
commit 98f28ec5bf
32 changed files with 1839 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://docs.cocos.com/creator/manual/en/scripting/setup.html#custom-script-template

View File

@@ -0,0 +1,5 @@
{
"image": {
"type": "sprite-frame"
}
}

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
#///////////////////////////
# Cocos Creator 3D Project
#///////////////////////////
library/
temp/
local/
build/
profiles/
native
#//////////////////////////
# NPM
#//////////////////////////
node_modules/
#//////////////////////////
# VSCode
#//////////////////////////
.vscode/
#//////////////////////////
# WebStorm
#//////////////////////////
.idea/

14
assets/resources.meta Normal file
View File

@@ -0,0 +1,14 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "b8df7e7c-f776-4f83-9552-acb313c0e412",
"files": [],
"subMetas": {},
"userData": {
"isBundle": true,
"bundleConfigID": "default",
"bundleName": "resources",
"priority": 8
}
}

BIN
assets/resources/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "fbc7d471-bfe8-41f6-9c7c-0a864d440e27",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "8904f884-6212-4124-b509-41cc08916647",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,90 @@
50004.png
size: 1409, 1115
format: RGBA8888
filter: Linear, Linear
repeat: none
950000
rotate: false
xy: 2, 303
size: 273, 810
orig: 623, 1531
offset: 175, 613
index: -1
huangguan_f
rotate: false
xy: 541, 7
size: 453, 347
orig: 455, 349
offset: 1, 1
index: -1
kou_f
rotate: false
xy: 1237, 141
size: 150, 311
orig: 150, 311
offset: 0, 0
index: -1
kou_f 2
rotate: false
xy: 2, 2
size: 137, 299
orig: 137, 299
offset: 0, 0
index: -1
ppifeng_f
rotate: false
xy: 996, 60
size: 239, 334
orig: 241, 334
offset: 1, 0
index: -1
ppifeng_f 2
rotate: true
xy: 1136, 454
size: 126, 266
orig: 126, 266
offset: 0, 0
index: -1
shenti_f
rotate: true
xy: 750, 582
size: 531, 657
orig: 533, 661
offset: 1, 2
index: -1
shou_f
rotate: true
xy: 750, 380
size: 200, 199
orig: 202, 202
offset: 1, 1
index: -1
toufa1_f
rotate: true
xy: 336, 2
size: 352, 203
orig: 352, 203
offset: 0, 0
index: -1
toufa2_f
rotate: true
xy: 141, 22
size: 279, 193
orig: 279, 193
offset: 0, 0
index: -1
toufa3_f
rotate: true
xy: 277, 356
size: 757, 471
orig: 757, 471
offset: 0, 0
index: -1
toufa4_f
rotate: true
xy: 951, 396
size: 184, 183
orig: 184, 183
offset: 0, 0
index: -1

View File

@@ -0,0 +1,12 @@
{
"ver": "1.0.0",
"importer": "*",
"imported": true,
"uuid": "0896305b-487b-495f-99a0-446bc5edecc3",
"files": [
".atlas",
".json"
],
"subMetas": {},
"userData": {}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
{
"ver": "1.2.7",
"importer": "spine-data",
"imported": true,
"uuid": "c284a7ee-d6a5-4a63-b702-9401a8686dca",
"files": [
".json"
],
"subMetas": {},
"userData": {
"atlasUuid": "0896305b-487b-495f-99a0-446bc5edecc3"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "d6289087-2fa1-4781-b194-8dc75ce3629f",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "d6289087-2fa1-4781-b194-8dc75ce3629f@6c48a",
"displayName": "50004",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "d6289087-2fa1-4781-b194-8dc75ce3629f",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "d6289087-2fa1-4781-b194-8dc75ce3629f@f9941",
"displayName": "50004",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 2,
"trimY": 3,
"width": 1405,
"height": 1110,
"rawWidth": 1409,
"rawHeight": 1115,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-702.5,
-555,
0,
702.5,
-555,
0,
-702.5,
555,
0,
702.5,
555,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
2,
1112,
1407,
1112,
2,
2,
1407,
2
],
"nuv": [
0.0014194464158978,
0.0017937219730941704,
0.9985805535841022,
0.0017937219730941704,
0.0014194464158978,
0.9973094170403587,
0.9985805535841022,
0.9973094170403587
],
"minPos": [
-702.5,
-555,
0
],
"maxPos": [
702.5,
555,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "d6289087-2fa1-4781-b194-8dc75ce3629f@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "d6289087-2fa1-4781-b194-8dc75ce3629f@6c48a"
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "7476fb7b-162a-445f-ae34-0690ab54082f",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "361c5873-d797-420e-be65-81c5a8f91215",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "361c5873-d797-420e-be65-81c5a8f91215@6c48a",
"displayName": "Bg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "361c5873-d797-420e-be65-81c5a8f91215",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "361c5873-d797-420e-be65-81c5a8f91215@f9941",
"displayName": "Bg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1080,
"height": 2560,
"rawWidth": 1080,
"rawHeight": 2560,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-540,
-1280,
0,
540,
-1280,
0,
-540,
1280,
0,
540,
1280,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
2560,
1080,
2560,
0,
0,
1080,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-540,
-1280,
0
],
"maxPos": [
540,
1280,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "361c5873-d797-420e-be65-81c5a8f91215@6c48a",
"atlasUuid": "",
"trimType": "auto"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "361c5873-d797-420e-be65-81c5a8f91215@6c48a"
}
}

9
assets/scenes.meta Normal file
View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "5f52ed63-7a25-4443-a294-2bfd985d7184",
"files": [],
"subMetas": {},
"userData": {}
}

815
assets/scenes/main.scene Normal file
View File

@@ -0,0 +1,815 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "main",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "main",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 18
},
"_id": "58132e64-0171-4c7f-89be-a2984ca7de6b"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 9
},
{
"__id__": 6
},
{
"__id__": 12
}
],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 15
},
{
"__id__": 16
},
{
"__id__": 17
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 360,
"y": 667,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "beI88Z2HpFELqR4T5EMHpg"
},
{
"__type__": "cc.Node",
"_name": "Camera",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 5
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1.0000000000000002,
"y": 1.0000000000000002,
"z": 1.0000000000000002
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "ebFwiq8gBFaYpqYbdoDODe"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 0,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 667,
"_near": 0,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 1108344832,
"_targetTexture": null,
"_postProcess": null,
"_usePostProcess": false,
"_cameraType": -1,
"_trackingType": 0,
"_id": "63WIch3o5BEYRlXzTT0oWc"
},
{
"__type__": "424a4ARzcRL9aX1sexNnCui",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": false,
"__prefab": null,
"target": {
"__id__": 6
},
"map": {
"__id__": 2
},
"offset": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"smoothSpeed": 5,
"_id": "beEkckKT1Ec5vv/5QnojSZ"
},
{
"__type__": "cc.Node",
"_name": "king",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
},
{
"__id__": 8
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 134.715,
"y": -841.498,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 0.183,
"y": 0.183,
"z": 0.183
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "63WyWIx4BOboo45ja5YJ4v"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 6
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1059.699951171875,
"height": 1531
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5772954967952078,
"y": 0.36362509599781595
},
"_id": "ablFNIo+xBqLLTaBmwelW6"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 6
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": {
"__uuid__": "c284a7ee-d6a5-4a63-b702-9401a8686dca",
"__expectedType__": "sp.SkeletonData"
},
"defaultSkin": "default",
"defaultAnimation": "idle",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": 0,
"_cacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": "f0I+7RM3NCv7gG/ZILUxjB"
},
{
"__type__": "cc.Node",
"_name": "Bg",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 11
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "9fWIW0nlZOAKYYrvMjuWpy"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 2560
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "45vczKBs5CfZpW98yME17u"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "361c5873-d797-420e-be65-81c5a8f91215@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "f9zWrrB85EzKBNoudMPMro"
},
{
"__type__": "cc.Node",
"_name": "node",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 13
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": -360,
"y": -667,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "25oux7pUtPopnkQBFPwYfp"
},
{
"__type__": "7d60dwmnZFI1LSM6LbxFuOw",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 12
},
"_enabled": true,
"__prefab": null,
"camera": {
"__id__": 4
},
"player": {
"__id__": 6
},
"map": {
"__id__": 9
},
"gridSize": 10,
"moveSpeed": 200,
"camSmooth": 5,
"_id": "0bSAKLAo1Hi6IeZn1HMR33"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 1080,
"height": 2560
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "d6rUX5yfhMlKoWX2bSbawx"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_cameraComponent": {
"__id__": 4
},
"_alignCanvasWithScreen": true,
"_id": "12O/ljcVlEqLmVm3U2gEOQ"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"_alignFlags": 45,
"_target": null,
"_left": -180,
"_right": -180,
"_top": -613,
"_bottom": -613,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": "c5V1EV8IpMtrIvY1OE9t2u"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": false,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "361c5873-d797-420e-be65-81c5a8f91215@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "3deM0mxjRKc5YJYLZwxQfb"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 19
},
"shadows": {
"__id__": 20
},
"_skybox": {
"__id__": 21
},
"fog": {
"__id__": 22
},
"octree": {
"__id__": 23
},
"skin": {
"__id__": 24
},
"lightProbeInfo": {
"__id__": 25
},
"postSettings": {
"__id__": 26
},
"bakedWithStationaryMainLight": false,
"bakedWithHighpLightmap": false
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0,
"y": 0,
"z": 0,
"w": 0
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.5,
"z": 0.8,
"w": 1
},
"_skyIllumLDR": 20000,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.2,
"y": 0.2,
"z": 0.2,
"w": 1
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_planeBias": 1,
"_shadowColor": {
"__type__": "cc.Color",
"r": 76,
"g": 76,
"b": 76,
"a": 255
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 512,
"y": 512
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": null,
"_envmap": null,
"_envmapLDR": null,
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": false,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
},
{
"__type__": "cc.SkinInfo",
"_enabled": false,
"_blurRadius": 0.01,
"_sssIntensity": 3
},
{
"__type__": "cc.LightProbeInfo",
"_giScale": 1,
"_giSamples": 1024,
"_bounces": 2,
"_reduceRinging": 0,
"_showProbe": true,
"_showWireframe": true,
"_showConvex": false,
"_data": null,
"_lightProbeSphereVolume": 1
},
{
"__type__": "cc.PostSettingsInfo",
"_toneMappingType": 0
}
]

View File

@@ -0,0 +1,11 @@
{
"ver": "1.1.50",
"importer": "scene",
"imported": true,
"uuid": "58132e64-0171-4c7f-89be-a2984ca7de6b",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

9
assets/scripts.meta Normal file
View File

@@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "0e5161fd-68d2-4b70-a816-4140dcfbe208",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,61 @@
import { _decorator, Component, Node, Vec3, UITransform, math } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('CameraFollow2D')
export class CameraFollow2D extends Component {
@property(Node)
target: Node = null!; // 要跟随的角色
@property(Node)
map: Node = null!; // 地图节点(需要有 UITransform 才能获取大小)
@property
offset: Vec3 = new Vec3(0, 0, 1000); // 相机与角色的偏移Z 轴拉远)
@property
smoothSpeed: number = 5; // 平滑跟随速度,越大越快
private _currentPos: Vec3 = new Vec3();
private _mapSize: Vec3 = new Vec3();
onLoad() {
if (this.map) {
const ui = this.map.getComponent(UITransform);
if (ui) {
this._mapSize.set(ui.width, ui.height, 0);
}
}
}
update(deltaTime: number) {
if (!this.target) return;
// 目标位置
const targetPos = this.target.getWorldPosition();
const desiredPos = new Vec3(
targetPos.x + this.offset.x,
targetPos.y + this.offset.y,
this.offset.z // 相机保持固定 Z
);
// 平滑跟随
Vec3.lerp(this._currentPos, this.node.getWorldPosition(), desiredPos, deltaTime * this.smoothSpeed);
// 限制相机不超出地图
if (this.map) {
const halfW = this._mapSize.x / 2;
const halfH = this._mapSize.y / 2;
// 相机视口一半宽高(取 UITransform 尺寸的一半)
const camUI = this.getComponent(UITransform);
let viewW = camUI ? camUI.width / 2 : 0;
let viewH = camUI ? camUI.height / 2 : 0;
this._currentPos.x = math.clamp(this._currentPos.x, -halfW + viewW, halfW - viewW);
this._currentPos.y = math.clamp(this._currentPos.y, -halfH + viewH, halfH - viewH);
}
// 更新相机位置
this.node.setWorldPosition(this._currentPos);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "424a4011-cdc4-4bf5-a5f5-b1ec4d9c2ba2",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,177 @@
import { _decorator, Component, input, Input, EventTouch, Camera, Node, Vec3, UITransform, math } from 'cc';
const { ccclass, property } = _decorator;
interface NodeCell {
x: number;
y: number;
g: number;
h: number;
f: number;
parent?: NodeCell;
}
@ccclass('GameController')
export class GameController extends Component {
@property(Camera)
camera: Camera = null!;
@property(Node)
player: Node = null!;
@property(Node)
map: Node = null!;
@property
gridSize: number = 32;
@property
moveSpeed: number = 200;
@property
camSmooth: number = 5;
private mapData: number[][] = [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 0, 0, 1, 1, 1, 0],
[0, 0, 0, 1, 0, 0, 0, 0, 1, 0],
[0, 1, 0, 0, 0, 1, 1, 0, 0, 0],
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
];
private path: Vec3[] = [];
private camPos: Vec3 = new Vec3();
private mapSize: Vec3 = new Vec3();
onLoad() {
input.on(Input.EventType.TOUCH_END, this.onTouchEnd, this);
// 获取地图大小
const ui = this.map.getComponent(UITransform);
if (ui) {
this.mapSize.set(ui.width, ui.height, 0);
}
}
onDestroy() {
input.off(Input.EventType.TOUCH_END, this.onTouchEnd, this);
}
// 点击地图 -> 计算寻路路径
onTouchEnd(event: EventTouch) {
if (!this.camera) return;
const screenPos = event.getLocation();
const worldPos = this.camera.screenToWorld(new Vec3(screenPos.x, screenPos.y, 0));
const startCell = this.worldToCell(this.player.getWorldPosition());
const endCell = this.worldToCell(worldPos);
const cellPath = this.findPath(startCell, endCell);
if (cellPath.length > 0) {
this.path = cellPath.map(c => this.cellToWorld(c));
}
}
update(deltaTime: number) {
// === 角色移动 ===
if (this.path.length > 0) {
const pos = this.player.getWorldPosition();
const target = this.path[0];
const dir = target.subtract(pos);
const dist = dir.length();
if (dist < this.moveSpeed * deltaTime) {
this.player.setWorldPosition(target);
this.path.shift();
} else {
dir.normalize();
const move = dir.multiplyScalar(this.moveSpeed * deltaTime);
this.player.setWorldPosition(pos.add(move));
}
}
// === 相机跟随 ===
const targetPos = this.player.getWorldPosition();
const desiredPos = new Vec3(targetPos.x, targetPos.y, 1000); // Z 拉远
Vec3.lerp(this.camPos, this.camera.node.getWorldPosition(), desiredPos, deltaTime * this.camSmooth);
// 限制相机范围
const halfW = this.mapSize.x / 2;
const halfH = this.mapSize.y / 2;
const viewW = 400; // 你可以用实际相机视口宽高
const viewH = 300;
this.camPos.x = math.clamp(this.camPos.x, -halfW + viewW, halfW - viewW);
this.camPos.y = math.clamp(this.camPos.y, -halfH + viewH, halfH - viewH);
this.camera.node.setWorldPosition(this.camPos);
}
// ============ A* 寻路实现 ============
worldToCell(worldPos: Vec3): { x: number, y: number } {
return {
x: Math.floor(worldPos.x / this.gridSize),
y: Math.floor(worldPos.y / this.gridSize),
};
}
cellToWorld(cell: { x: number, y: number }): Vec3 {
return new Vec3(
cell.x * this.gridSize + this.gridSize / 2,
cell.y * this.gridSize + this.gridSize / 2,
0
);
}
findPath(start: { x: number, y: number }, end: { x: number, y: number }): { x: number, y: number }[] {
const open: NodeCell[] = [];
const closed: boolean[][] = [];
const rows = this.mapData.length;
const cols = this.mapData[0].length;
function heuristic(a: { x: number, y: number }, b: { x: number, y: number }) {
return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
}
open.push({ x: start.x, y: start.y, g: 0, h: heuristic(start, end), f: 0 });
while (open.length > 0) {
open.sort((a, b) => (a.g + a.h) - (b.g + b.h));
const current = open.shift()!;
closed[current.y] = closed[current.y] || [];
closed[current.y][current.x] = true;
if (current.x === end.x && current.y === end.y) {
const path: { x: number, y: number }[] = [];
let node: NodeCell | undefined = current;
while (node) {
path.unshift({ x: node.x, y: node.y });
node = node.parent;
}
return path;
}
const neighbors = [
{ x: current.x + 1, y: current.y },
{ x: current.x - 1, y: current.y },
{ x: current.x, y: current.y + 1 },
{ x: current.x, y: current.y - 1 },
];
for (const n of neighbors) {
if (n.x < 0 || n.y < 0 || n.y >= rows || n.x >= cols) continue;
if (this.mapData[n.y][n.x] === 1) continue;
if (closed[n.y]?.[n.x]) continue;
const g = current.g + 1;
const h = heuristic(n, end);
const existing = open.find(o => o.x === n.x && o.y === n.y);
if (!existing || g < existing.g) {
open.push({ x: n.x, y: n.y, g, h, f: g + h, parent: current });
}
}
}
return [];
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "7d60dc26-9d91-48d4-b48c-e8b6f116e3b0",
"files": [],
"subMetas": {},
"userData": {}
}

7
package.json Executable file
View File

@@ -0,0 +1,7 @@
{
"name": "climb",
"uuid": "d065c4bc-6fc9-4382-bdfb-e44cbe014bb2",
"creator": {
"version": "3.8.7"
}
}

View File

@@ -0,0 +1,3 @@
{
"__version__": "1.3.9"
}

View File

@@ -0,0 +1,3 @@
{
"__version__": "1.0.1"
}

View File

@@ -0,0 +1,226 @@
{
"__version__": "1.0.12",
"modules": {
"configs": {
"defaultConfig": {
"name": "Default Config",
"cache": {
"base": {
"_value": true
},
"gfx-webgl": {
"_value": true
},
"gfx-webgl2": {
"_value": true
},
"gfx-webgpu": {
"_value": false
},
"animation": {
"_value": true
},
"skeletal-animation": {
"_value": false
},
"3d": {
"_value": false
},
"meshopt": {
"_value": false
},
"2d": {
"_value": true
},
"sorting-2d": {
"_value": false
},
"rich-text": {
"_value": true
},
"mask": {
"_value": true
},
"graphics": {
"_value": true
},
"ui-skew": {
"_value": false
},
"affine-transform": {
"_value": true
},
"ui": {
"_value": true
},
"particle": {
"_value": false
},
"physics": {
"_value": false,
"_option": "physics-ammo"
},
"physics-ammo": {
"_value": false,
"_flags": {
"LOAD_BULLET_MANUALLY": false
}
},
"physics-cannon": {
"_value": false
},
"physics-physx": {
"_value": false,
"_flags": {
"LOAD_PHYSX_MANUALLY": false
}
},
"physics-builtin": {
"_value": false
},
"physics-2d": {
"_value": true,
"_option": "physics-2d-box2d"
},
"physics-2d-box2d": {
"_value": false
},
"physics-2d-box2d-wasm": {
"_value": false,
"_flags": {
"LOAD_BOX2D_MANUALLY": false
}
},
"physics-2d-builtin": {
"_value": false
},
"physics-2d-box2d-jsb": {
"_value": false
},
"intersection-2d": {
"_value": true
},
"primitive": {
"_value": false
},
"profiler": {
"_value": true
},
"occlusion-query": {
"_value": false
},
"geometry-renderer": {
"_value": false
},
"debug-renderer": {
"_value": false
},
"particle-2d": {
"_value": true
},
"audio": {
"_value": true
},
"video": {
"_value": true
},
"webview": {
"_value": true
},
"tween": {
"_value": true
},
"websocket": {
"_value": false
},
"websocket-server": {
"_value": false
},
"terrain": {
"_value": false
},
"light-probe": {
"_value": false
},
"tiled-map": {
"_value": true
},
"vendor-google": {
"_value": false
},
"spine": {
"_value": true,
"_option": "spine-3.8"
},
"spine-3.8": {
"_value": true,
"_flags": {
"LOAD_SPINE_MANUALLY": false
}
},
"spine-4.2": {
"_value": false,
"_flags": {
"LOAD_SPINE_MANUALLY": false
}
},
"dragon-bones": {
"_value": true
},
"marionette": {
"_value": false
},
"procedural-animation": {
"_value": false
},
"custom-pipeline-post-process": {
"_value": false
},
"render-pipeline": {
"_value": true,
"_option": "custom-pipeline"
},
"custom-pipeline": {
"_value": true
},
"legacy-pipeline": {
"_value": false
},
"xr": {
"_value": false
}
},
"includeModules": [
"2d",
"affine-transform",
"animation",
"audio",
"base",
"custom-pipeline",
"dragon-bones",
"gfx-webgl",
"gfx-webgl2",
"graphics",
"intersection-2d",
"mask",
"particle-2d",
"physics-2d-box2d",
"profiler",
"rich-text",
"spine-3.8",
"tiled-map",
"tween",
"ui",
"video",
"webview"
],
"noDeprecatedFeatures": {
"value": false,
"version": ""
},
"flags": {}
}
},
"globalConfigKey": "defaultConfig"
}
}

View File

@@ -0,0 +1,23 @@
{
"__version__": "1.0.1",
"information": {
"customSplash": {
"id": "customSplash",
"label": "customSplash",
"enable": false,
"customSplash": {
"complete": false,
"form": "https://creator-api.cocos.com/api/form/show?"
}
},
"removeSplash": {
"id": "removeSplash",
"label": "removeSplash",
"enable": false,
"removeSplash": {
"complete": false,
"form": "https://creator-api.cocos.com/api/form/show?"
}
}
}
}

View File

@@ -0,0 +1,3 @@
{
"__version__": "1.0.4"
}

View File

@@ -0,0 +1,9 @@
{
"__version__": "1.0.6",
"general": {
"designResolution": {
"width": 720,
"height": 1334
}
}
}

9
tsconfig.json Normal file
View File

@@ -0,0 +1,9 @@
{
/* Base configuration. Do not edit this field. */
"extends": "./temp/tsconfig.cocos.json",
/* Add your custom configuration here. */
"compilerOptions": {
"strict": false
}
}