├── .gitignore ├── README.md ├── assets ├── Scene.meta ├── Scene │ ├── Camera.fire │ └── Camera.fire.meta ├── Script.meta ├── Script │ ├── Game.ts │ └── Game.ts.meta ├── Texture.meta ├── Texture │ ├── bg_01@2x.png │ ├── bg_01@2x.png.meta │ ├── singleColor.png │ ├── singleColor.png.meta │ ├── sun@2x.png │ ├── sun@2x.png.meta │ ├── theme_front_01@2x.png │ └── theme_front_01@2x.png.meta ├── resources.meta └── resources │ ├── idle_babarian_run_01@2x.png │ ├── idle_babarian_run_01@2x.png.meta │ ├── idle_babarian_run_02@2x.png │ ├── idle_babarian_run_02@2x.png.meta │ ├── idle_babarian_run_03@2x.png │ ├── idle_babarian_run_03@2x.png.meta │ ├── idle_babarian_run_04@2x.png │ ├── idle_babarian_run_04@2x.png.meta │ ├── idle_babarian_run_05@2x.png │ ├── idle_babarian_run_05@2x.png.meta │ ├── player_run.anim │ └── player_run.anim.meta ├── camerashots ├── addcamera.png ├── addcamera.png.meta ├── addgroup.png ├── addgroup.png.meta ├── camera-demo.gif ├── camera.md ├── crude.png ├── crude.png.meta ├── crude2.png ├── crude2.png.meta ├── demo.gif ├── farcamera.png ├── farcamera.png.meta ├── fargroup.png ├── fargroup.png.meta ├── nearcamera.png ├── nearcamera.png.meta ├── neargroup.png ├── neargroup.png.meta ├── node.png ├── node.png.meta ├── step1.png └── step1.png.meta ├── creator.d.ts ├── jsconfig.json ├── project.json ├── settings ├── builder.json ├── builder.panel.json ├── project.json └── services.json ├── template-banner.png ├── template.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | library/ 6 | temp/ 7 | local/ 8 | build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # Logs and databases 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | *.log 15 | *.sql 16 | *.sqlite 17 | 18 | #///////////////////////////////////////////////////////////////////////////// 19 | # files for debugger 20 | #///////////////////////////////////////////////////////////////////////////// 21 | 22 | *.sln 23 | *.csproj 24 | *.pidb 25 | *.unityproj 26 | *.suo 27 | 28 | #///////////////////////////////////////////////////////////////////////////// 29 | # OS generated files 30 | #///////////////////////////////////////////////////////////////////////////// 31 | 32 | .DS_Store 33 | ehthumbs.db 34 | Thumbs.db 35 | 36 | #///////////////////////////////////////////////////////////////////////////// 37 | # exvim files 38 | #///////////////////////////////////////////////////////////////////////////// 39 | 40 | *UnityVS.meta 41 | *.err 42 | *.err.meta 43 | *.exvim 44 | *.exvim.meta 45 | *.vimentry 46 | *.vimentry.meta 47 | *.vimproject 48 | *.vimproject.meta 49 | .vimfiles.*/ 50 | .exvim.*/ 51 | quick_gen_project_*_autogen.bat 52 | quick_gen_project_*_autogen.bat.meta 53 | quick_gen_project_*_autogen.sh 54 | quick_gen_project_*_autogen.sh.meta 55 | .exvim.app 56 | 57 | #///////////////////////////////////////////////////////////////////////////// 58 | # webstorm files 59 | #///////////////////////////////////////////////////////////////////////////// 60 | 61 | .idea/ 62 | 63 | #////////////////////////// 64 | # VS Code 65 | #////////////////////////// 66 | 67 | .vscode/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Camera 摄像机初探 2 | *作者:大掌教* 3 | 4 | *Q群:704391772* 5 | 6 | **直播课地址:** [https://ke.qq.com/course/378768?tuin=3ce6693]( https://ke.qq.com/course/378768?tuin=3ce6693 ) 7 | 8 | --- 9 | 10 | Creator从2.0开始发生了巨大变化,其中最大的变化莫过于Camera组件。为什么说最大的改变是Camera组件,因为这是一个全新的组件,将游戏世界的渲染窗口暴露出来,这将是引擎从2d渲染向3d渲染的关键。 11 | 12 | Camera是游戏渲染的窗口,场景里至少需要一个Camera,否则将无法渲染任何对象,世界将是一片黑暗。 13 | 14 | ### 要点 15 | - 一个场景至少需要一个Camera,可以同时存在多个Camera。 16 | - Camera本身不可见,渲染大小就是当前屏幕大小。 17 | - 同一场景可以多个Camera可以分组渲染,各自渲染各自的分组对象。 18 | - 多个Camera渲染的对象层次,由Camera深度Depth决定,值越大越后面渲染。同一个Camera渲染的对象,按照节点本身层级渲染,子节点总是在父节点后渲染。 19 | 20 | ## Camera案例——无限滚动视差背景 21 | Camera组件属性可参考[官方文档](https://docs.cocos.com/creator/manual/zh/render/camera.html#摄像机属性)。 22 | 23 | ### 分组渲染 24 | 25 | Creator编辑器在菜单`项目`->`项目设置`->`分组管理`中更改或添加。物理碰撞的分组管理也是这里设置的。 26 | 27 | 要实现分组渲染,首先需要在场景添加多个Camera,然后再分组管理添加多个分组,然后设置Camera的cullingMask属性为对应的分组。 28 | 29 | 1. 创建Camera节点,先创建一个空节点,然后在这个节点上添加Camera组件。添加两个Cameara节点,FarCamera和NearCamera,用来分别渲染远景和近景。 30 | 31 | ![空节点](camerashots/node.png)
32 | ![添加摄像机](camerashots/addcamera.png) 33 | 34 | 2. 添加分组,在分组管理里面添加两个分组,nearbg和farbg 35 | 36 | ![添加分组](camerashots/addgroup.png) 37 | 38 | 3. 场景中添加近景和远景节点,分别设置Group 39 | 40 | ![远景](camerashots/fargroup.png) 41 | 42 | ![近景](camerashots/neargroup.png) 43 | 44 | 4. 设置Camera的cullMask为对应分组,FarCamera设置为farbg,NearCamera设置为nearbg。 45 | 46 | ![远景摄像机](camerashots/farcamera.png) 47 | 48 | ![近景摄像机](camerashots/nearcamera.png) 49 | 50 | 到这里多摄像机和分组渲染设置完成了,运行模拟器可以看到界面 51 | ![运行结果](camerashots/step1.png) 52 | 53 | ### 视差原理 54 | 背景图片固定不动,移动摄像机。因为我们看到的画面都是摄像机渲染的画面,渲染区域就是屏幕大小。由于运动的相对性,我们观察的视角就是摄像机视角,和摄像机同步,背景图片就相对向相反方向移动。 55 | 56 | ![原理一](camerashots/crude.png) 57 | 58 | 如图,由于横向不断移动,所以要做两个背景图,不断交替设置位置。 59 | ![原理一](camerashots/crude2.png) 60 | 61 | 同样的原理,再设置一个近景,两组Camera移动的速度设置的不一致,就实现了无限滚动视差背景。 62 | 63 | ### 静景 64 | 有一些元素是不动的,比如太阳,月亮,挂在天上,如何实现? 65 | 66 | 新增分组celestial,将MainCamera开启,然后设置cullingMask为celestial,添加一个sun节点,分组设为celestial。 67 | 68 | 最终效果: 69 | ![原理一](camerashots/demo.gif) 70 | 71 | **Demo源码地址:** [https://github.com/fylz1125/CreatorDocuments](https://github.com/fylz1125/CreatorDocuments) 72 | 73 | # 更多Creator教程 74 | 2.0开始,新增了很多新特性,引擎发生了很大变化,后续将会分享更多干活。另外,每晚21:00,我将会在腾讯课堂直播讲解Creator游戏开发技术与实战经验,欢迎感兴趣的开发者关注。 75 | 76 | **直播地址:** [https://ke.qq.com/course/378768?tuin=3ce6693]( https://ke.qq.com/course/378768?tuin=3ce6693 ) -------------------------------------------------------------------------------- /assets/Scene.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Scene/Camera.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.22027587928058304, 45 | "y": 0.22027587928058304, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "2d2f792f-a40c-49bb-a189-ed176a246e49" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | }, 74 | { 75 | "__id__": 7 76 | }, 77 | { 78 | "__id__": 9 79 | }, 80 | { 81 | "__id__": 11 82 | }, 83 | { 84 | "__id__": 13 85 | }, 86 | { 87 | "__id__": 15 88 | }, 89 | { 90 | "__id__": 17 91 | }, 92 | { 93 | "__id__": 19 94 | }, 95 | { 96 | "__id__": 21 97 | } 98 | ], 99 | "_active": true, 100 | "_level": 0, 101 | "_components": [ 102 | { 103 | "__id__": 24 104 | }, 105 | { 106 | "__id__": 25 107 | } 108 | ], 109 | "_prefab": null, 110 | "_opacity": 255, 111 | "_color": { 112 | "__type__": "cc.Color", 113 | "r": 252, 114 | "g": 252, 115 | "b": 252, 116 | "a": 255 117 | }, 118 | "_contentSize": { 119 | "__type__": "cc.Size", 120 | "width": 1920, 121 | "height": 1024 122 | }, 123 | "_anchorPoint": { 124 | "__type__": "cc.Vec2", 125 | "x": 0.5, 126 | "y": 0.5 127 | }, 128 | "_position": { 129 | "__type__": "cc.Vec3", 130 | "x": 960, 131 | "y": 512, 132 | "z": 0 133 | }, 134 | "_scale": { 135 | "__type__": "cc.Vec3", 136 | "x": 1, 137 | "y": 1, 138 | "z": 1 139 | }, 140 | "_rotationX": 0, 141 | "_rotationY": 0, 142 | "_quat": { 143 | "__type__": "cc.Quat", 144 | "x": 0, 145 | "y": 0, 146 | "z": 0, 147 | "w": 1 148 | }, 149 | "_skewX": 0, 150 | "_skewY": 0, 151 | "_zIndex": 0, 152 | "groupIndex": 0, 153 | "_id": "a286bbGknJLZpRpxROV6M94" 154 | }, 155 | { 156 | "__type__": "cc.Node", 157 | "_name": "Main Camera", 158 | "_objFlags": 0, 159 | "_parent": { 160 | "__id__": 2 161 | }, 162 | "_children": [], 163 | "_active": true, 164 | "_level": 1, 165 | "_components": [ 166 | { 167 | "__id__": 4 168 | } 169 | ], 170 | "_prefab": null, 171 | "_opacity": 255, 172 | "_color": { 173 | "__type__": "cc.Color", 174 | "r": 255, 175 | "g": 255, 176 | "b": 255, 177 | "a": 255 178 | }, 179 | "_contentSize": { 180 | "__type__": "cc.Size", 181 | "width": 0, 182 | "height": 0 183 | }, 184 | "_anchorPoint": { 185 | "__type__": "cc.Vec2", 186 | "x": 0.5, 187 | "y": 0.5 188 | }, 189 | "_position": { 190 | "__type__": "cc.Vec3", 191 | "x": 0, 192 | "y": 0, 193 | "z": 0 194 | }, 195 | "_scale": { 196 | "__type__": "cc.Vec3", 197 | "x": 1, 198 | "y": 1, 199 | "z": 1 200 | }, 201 | "_rotationX": 0, 202 | "_rotationY": 0, 203 | "_quat": { 204 | "__type__": "cc.Quat", 205 | "x": 0, 206 | "y": 0, 207 | "z": 0, 208 | "w": 1 209 | }, 210 | "_skewX": 0, 211 | "_skewY": 0, 212 | "_zIndex": 0, 213 | "groupIndex": 0, 214 | "_id": "7e8xEctQ1EE5LqrudgcG0F" 215 | }, 216 | { 217 | "__type__": "cc.Camera", 218 | "_name": "", 219 | "_objFlags": 0, 220 | "node": { 221 | "__id__": 3 222 | }, 223 | "_enabled": true, 224 | "_cullingMask": 8, 225 | "_clearFlags": 6, 226 | "_backgroundColor": { 227 | "__type__": "cc.Color", 228 | "r": 0, 229 | "g": 0, 230 | "b": 0, 231 | "a": 255 232 | }, 233 | "_depth": 2, 234 | "_zoomRatio": 1, 235 | "_targetTexture": null, 236 | "_id": "86oNhf1sJILrUh0pmjilNZ" 237 | }, 238 | { 239 | "__type__": "cc.Node", 240 | "_name": "FarCamera", 241 | "_objFlags": 0, 242 | "_parent": { 243 | "__id__": 2 244 | }, 245 | "_children": [], 246 | "_active": true, 247 | "_level": 1, 248 | "_components": [ 249 | { 250 | "__id__": 6 251 | } 252 | ], 253 | "_prefab": null, 254 | "_opacity": 255, 255 | "_color": { 256 | "__type__": "cc.Color", 257 | "r": 255, 258 | "g": 255, 259 | "b": 255, 260 | "a": 255 261 | }, 262 | "_contentSize": { 263 | "__type__": "cc.Size", 264 | "width": 0, 265 | "height": 0 266 | }, 267 | "_anchorPoint": { 268 | "__type__": "cc.Vec2", 269 | "x": 0.5, 270 | "y": 0.5 271 | }, 272 | "_position": { 273 | "__type__": "cc.Vec3", 274 | "x": 0, 275 | "y": 0, 276 | "z": 0 277 | }, 278 | "_scale": { 279 | "__type__": "cc.Vec3", 280 | "x": 1, 281 | "y": 1, 282 | "z": 1 283 | }, 284 | "_rotationX": 0, 285 | "_rotationY": 0, 286 | "_quat": { 287 | "__type__": "cc.Quat", 288 | "x": 0, 289 | "y": 0, 290 | "z": 0, 291 | "w": 1 292 | }, 293 | "_skewX": 0, 294 | "_skewY": 0, 295 | "_zIndex": 0, 296 | "groupIndex": 0, 297 | "_id": "777+aSb81P97GCF671pGcr" 298 | }, 299 | { 300 | "__type__": "cc.Camera", 301 | "_name": "", 302 | "_objFlags": 0, 303 | "node": { 304 | "__id__": 5 305 | }, 306 | "_enabled": true, 307 | "_cullingMask": 4, 308 | "_clearFlags": 6, 309 | "_backgroundColor": { 310 | "__type__": "cc.Color", 311 | "r": 0, 312 | "g": 0, 313 | "b": 0, 314 | "a": 255 315 | }, 316 | "_depth": 0, 317 | "_zoomRatio": 1, 318 | "_targetTexture": null, 319 | "_id": "440eyu7ShGhr5jb4FaTbPH" 320 | }, 321 | { 322 | "__type__": "cc.Node", 323 | "_name": "NearCamera", 324 | "_objFlags": 0, 325 | "_parent": { 326 | "__id__": 2 327 | }, 328 | "_children": [], 329 | "_active": true, 330 | "_level": 1, 331 | "_components": [ 332 | { 333 | "__id__": 8 334 | } 335 | ], 336 | "_prefab": null, 337 | "_opacity": 255, 338 | "_color": { 339 | "__type__": "cc.Color", 340 | "r": 255, 341 | "g": 255, 342 | "b": 255, 343 | "a": 255 344 | }, 345 | "_contentSize": { 346 | "__type__": "cc.Size", 347 | "width": 0, 348 | "height": 0 349 | }, 350 | "_anchorPoint": { 351 | "__type__": "cc.Vec2", 352 | "x": 0.5, 353 | "y": 0.5 354 | }, 355 | "_position": { 356 | "__type__": "cc.Vec3", 357 | "x": 0, 358 | "y": 0, 359 | "z": 0 360 | }, 361 | "_scale": { 362 | "__type__": "cc.Vec3", 363 | "x": 1, 364 | "y": 1, 365 | "z": 1 366 | }, 367 | "_rotationX": 0, 368 | "_rotationY": 0, 369 | "_quat": { 370 | "__type__": "cc.Quat", 371 | "x": 0, 372 | "y": 0, 373 | "z": 0, 374 | "w": 1 375 | }, 376 | "_skewX": 0, 377 | "_skewY": 0, 378 | "_zIndex": 0, 379 | "groupIndex": 0, 380 | "_id": "35kI3+W61P1I1tGEb7+DfT" 381 | }, 382 | { 383 | "__type__": "cc.Camera", 384 | "_name": "", 385 | "_objFlags": 0, 386 | "node": { 387 | "__id__": 7 388 | }, 389 | "_enabled": true, 390 | "_cullingMask": 2, 391 | "_clearFlags": 6, 392 | "_backgroundColor": { 393 | "__type__": "cc.Color", 394 | "r": 0, 395 | "g": 0, 396 | "b": 0, 397 | "a": 255 398 | }, 399 | "_depth": 1, 400 | "_zoomRatio": 1, 401 | "_targetTexture": null, 402 | "_id": "770pJG8YNDq7ZUpjDce26u" 403 | }, 404 | { 405 | "__type__": "cc.Node", 406 | "_name": "PlayerCamera", 407 | "_objFlags": 0, 408 | "_parent": { 409 | "__id__": 2 410 | }, 411 | "_children": [], 412 | "_active": true, 413 | "_level": 1, 414 | "_components": [ 415 | { 416 | "__id__": 10 417 | } 418 | ], 419 | "_prefab": null, 420 | "_opacity": 255, 421 | "_color": { 422 | "__type__": "cc.Color", 423 | "r": 255, 424 | "g": 255, 425 | "b": 255, 426 | "a": 255 427 | }, 428 | "_contentSize": { 429 | "__type__": "cc.Size", 430 | "width": 0, 431 | "height": 0 432 | }, 433 | "_anchorPoint": { 434 | "__type__": "cc.Vec2", 435 | "x": 0.5, 436 | "y": 0.5 437 | }, 438 | "_position": { 439 | "__type__": "cc.Vec3", 440 | "x": 0, 441 | "y": 0, 442 | "z": 0 443 | }, 444 | "_scale": { 445 | "__type__": "cc.Vec3", 446 | "x": 1, 447 | "y": 1, 448 | "z": 1 449 | }, 450 | "_rotationX": 0, 451 | "_rotationY": 0, 452 | "_quat": { 453 | "__type__": "cc.Quat", 454 | "x": 0, 455 | "y": 0, 456 | "z": 0, 457 | "w": 1 458 | }, 459 | "_skewX": 0, 460 | "_skewY": 0, 461 | "_zIndex": 0, 462 | "groupIndex": 4, 463 | "_id": "e2Y3hzXkRBj6FtKlr9YrjV" 464 | }, 465 | { 466 | "__type__": "cc.Camera", 467 | "_name": "", 468 | "_objFlags": 0, 469 | "node": { 470 | "__id__": 9 471 | }, 472 | "_enabled": true, 473 | "_cullingMask": 16, 474 | "_clearFlags": 6, 475 | "_backgroundColor": { 476 | "__type__": "cc.Color", 477 | "r": 0, 478 | "g": 0, 479 | "b": 0, 480 | "a": 255 481 | }, 482 | "_depth": 0, 483 | "_zoomRatio": 1, 484 | "_targetTexture": null, 485 | "_id": "136lU2P9tPGbeS6fBQSnfh" 486 | }, 487 | { 488 | "__type__": "cc.Node", 489 | "_name": "farbg", 490 | "_objFlags": 0, 491 | "_parent": { 492 | "__id__": 2 493 | }, 494 | "_children": [], 495 | "_active": true, 496 | "_level": 1, 497 | "_components": [ 498 | { 499 | "__id__": 12 500 | } 501 | ], 502 | "_prefab": null, 503 | "_opacity": 255, 504 | "_color": { 505 | "__type__": "cc.Color", 506 | "r": 255, 507 | "g": 255, 508 | "b": 255, 509 | "a": 255 510 | }, 511 | "_contentSize": { 512 | "__type__": "cc.Size", 513 | "width": 2048, 514 | "height": 1024 515 | }, 516 | "_anchorPoint": { 517 | "__type__": "cc.Vec2", 518 | "x": 0.5, 519 | "y": 0.5 520 | }, 521 | "_position": { 522 | "__type__": "cc.Vec3", 523 | "x": 0, 524 | "y": 0, 525 | "z": 0 526 | }, 527 | "_scale": { 528 | "__type__": "cc.Vec3", 529 | "x": 1, 530 | "y": 1, 531 | "z": 1 532 | }, 533 | "_rotationX": 0, 534 | "_rotationY": 0, 535 | "_quat": { 536 | "__type__": "cc.Quat", 537 | "x": 0, 538 | "y": 0, 539 | "z": 0, 540 | "w": 1 541 | }, 542 | "_skewX": 0, 543 | "_skewY": 0, 544 | "_zIndex": 0, 545 | "groupIndex": 2, 546 | "_id": "d0JXcvXSNJdK7G1PDJZdL3" 547 | }, 548 | { 549 | "__type__": "cc.Sprite", 550 | "_name": "", 551 | "_objFlags": 0, 552 | "node": { 553 | "__id__": 11 554 | }, 555 | "_enabled": true, 556 | "_srcBlendFactor": 770, 557 | "_dstBlendFactor": 771, 558 | "_spriteFrame": { 559 | "__uuid__": "bbbdd15a-39ca-4769-b1da-8b11937373e7" 560 | }, 561 | "_type": 0, 562 | "_sizeMode": 1, 563 | "_fillType": 0, 564 | "_fillCenter": { 565 | "__type__": "cc.Vec2", 566 | "x": 0, 567 | "y": 0 568 | }, 569 | "_fillStart": 0, 570 | "_fillRange": 0, 571 | "_isTrimmedMode": true, 572 | "_state": 0, 573 | "_atlas": null, 574 | "_id": "8cQxgM78RGwbHK5DtJBFm/" 575 | }, 576 | { 577 | "__type__": "cc.Node", 578 | "_name": "farbg1", 579 | "_objFlags": 0, 580 | "_parent": { 581 | "__id__": 2 582 | }, 583 | "_children": [], 584 | "_active": true, 585 | "_level": 1, 586 | "_components": [ 587 | { 588 | "__id__": 14 589 | } 590 | ], 591 | "_prefab": null, 592 | "_opacity": 255, 593 | "_color": { 594 | "__type__": "cc.Color", 595 | "r": 255, 596 | "g": 255, 597 | "b": 255, 598 | "a": 255 599 | }, 600 | "_contentSize": { 601 | "__type__": "cc.Size", 602 | "width": 2048, 603 | "height": 1024 604 | }, 605 | "_anchorPoint": { 606 | "__type__": "cc.Vec2", 607 | "x": 0.5, 608 | "y": 0.5 609 | }, 610 | "_position": { 611 | "__type__": "cc.Vec3", 612 | "x": 2048, 613 | "y": 0, 614 | "z": 0 615 | }, 616 | "_scale": { 617 | "__type__": "cc.Vec3", 618 | "x": 1, 619 | "y": 1, 620 | "z": 1 621 | }, 622 | "_rotationX": 0, 623 | "_rotationY": 0, 624 | "_quat": { 625 | "__type__": "cc.Quat", 626 | "x": 0, 627 | "y": 0, 628 | "z": 0, 629 | "w": 1 630 | }, 631 | "_skewX": 0, 632 | "_skewY": 0, 633 | "_zIndex": 0, 634 | "groupIndex": 2, 635 | "_id": "e53lDS/ZpJFLY1Z57gLdDf" 636 | }, 637 | { 638 | "__type__": "cc.Sprite", 639 | "_name": "", 640 | "_objFlags": 0, 641 | "node": { 642 | "__id__": 13 643 | }, 644 | "_enabled": true, 645 | "_srcBlendFactor": 770, 646 | "_dstBlendFactor": 771, 647 | "_spriteFrame": { 648 | "__uuid__": "bbbdd15a-39ca-4769-b1da-8b11937373e7" 649 | }, 650 | "_type": 0, 651 | "_sizeMode": 1, 652 | "_fillType": 0, 653 | "_fillCenter": { 654 | "__type__": "cc.Vec2", 655 | "x": 0, 656 | "y": 0 657 | }, 658 | "_fillStart": 0, 659 | "_fillRange": 0, 660 | "_isTrimmedMode": true, 661 | "_state": 0, 662 | "_atlas": null, 663 | "_id": "e8dwG1sxpGkqlHiF+qJBa/" 664 | }, 665 | { 666 | "__type__": "cc.Node", 667 | "_name": "nearbg", 668 | "_objFlags": 0, 669 | "_parent": { 670 | "__id__": 2 671 | }, 672 | "_children": [], 673 | "_active": true, 674 | "_level": 1, 675 | "_components": [ 676 | { 677 | "__id__": 16 678 | } 679 | ], 680 | "_prefab": null, 681 | "_opacity": 255, 682 | "_color": { 683 | "__type__": "cc.Color", 684 | "r": 255, 685 | "g": 255, 686 | "b": 255, 687 | "a": 255 688 | }, 689 | "_contentSize": { 690 | "__type__": "cc.Size", 691 | "width": 2048, 692 | "height": 208 693 | }, 694 | "_anchorPoint": { 695 | "__type__": "cc.Vec2", 696 | "x": 0.5, 697 | "y": 0.5 698 | }, 699 | "_position": { 700 | "__type__": "cc.Vec3", 701 | "x": 0, 702 | "y": -408, 703 | "z": 0 704 | }, 705 | "_scale": { 706 | "__type__": "cc.Vec3", 707 | "x": 1, 708 | "y": 1, 709 | "z": 1 710 | }, 711 | "_rotationX": 0, 712 | "_rotationY": 0, 713 | "_quat": { 714 | "__type__": "cc.Quat", 715 | "x": 0, 716 | "y": 0, 717 | "z": 0, 718 | "w": 1 719 | }, 720 | "_skewX": 0, 721 | "_skewY": 0, 722 | "_zIndex": 0, 723 | "groupIndex": 1, 724 | "_id": "0fSgWCfhVMsKVLYIX1HQmS" 725 | }, 726 | { 727 | "__type__": "cc.Sprite", 728 | "_name": "", 729 | "_objFlags": 0, 730 | "node": { 731 | "__id__": 15 732 | }, 733 | "_enabled": true, 734 | "_srcBlendFactor": 770, 735 | "_dstBlendFactor": 771, 736 | "_spriteFrame": { 737 | "__uuid__": "4cade94e-9aee-432e-abeb-024583e7b108" 738 | }, 739 | "_type": 0, 740 | "_sizeMode": 1, 741 | "_fillType": 0, 742 | "_fillCenter": { 743 | "__type__": "cc.Vec2", 744 | "x": 0, 745 | "y": 0 746 | }, 747 | "_fillStart": 0, 748 | "_fillRange": 0, 749 | "_isTrimmedMode": true, 750 | "_state": 0, 751 | "_atlas": null, 752 | "_id": "07g92CgctPRLsPujxiQLKc" 753 | }, 754 | { 755 | "__type__": "cc.Node", 756 | "_name": "nearbg1", 757 | "_objFlags": 0, 758 | "_parent": { 759 | "__id__": 2 760 | }, 761 | "_children": [], 762 | "_active": true, 763 | "_level": 1, 764 | "_components": [ 765 | { 766 | "__id__": 18 767 | } 768 | ], 769 | "_prefab": null, 770 | "_opacity": 255, 771 | "_color": { 772 | "__type__": "cc.Color", 773 | "r": 255, 774 | "g": 255, 775 | "b": 255, 776 | "a": 255 777 | }, 778 | "_contentSize": { 779 | "__type__": "cc.Size", 780 | "width": 2048, 781 | "height": 208 782 | }, 783 | "_anchorPoint": { 784 | "__type__": "cc.Vec2", 785 | "x": 0.5, 786 | "y": 0.5 787 | }, 788 | "_position": { 789 | "__type__": "cc.Vec3", 790 | "x": 2048, 791 | "y": -408, 792 | "z": 0 793 | }, 794 | "_scale": { 795 | "__type__": "cc.Vec3", 796 | "x": 1, 797 | "y": 1, 798 | "z": 1 799 | }, 800 | "_rotationX": 0, 801 | "_rotationY": 0, 802 | "_quat": { 803 | "__type__": "cc.Quat", 804 | "x": 0, 805 | "y": 0, 806 | "z": 0, 807 | "w": 1 808 | }, 809 | "_skewX": 0, 810 | "_skewY": 0, 811 | "_zIndex": 0, 812 | "groupIndex": 1, 813 | "_id": "0efV/Ydy9Plar2/i1mgG5G" 814 | }, 815 | { 816 | "__type__": "cc.Sprite", 817 | "_name": "", 818 | "_objFlags": 0, 819 | "node": { 820 | "__id__": 17 821 | }, 822 | "_enabled": true, 823 | "_srcBlendFactor": 770, 824 | "_dstBlendFactor": 771, 825 | "_spriteFrame": { 826 | "__uuid__": "4cade94e-9aee-432e-abeb-024583e7b108" 827 | }, 828 | "_type": 0, 829 | "_sizeMode": 1, 830 | "_fillType": 0, 831 | "_fillCenter": { 832 | "__type__": "cc.Vec2", 833 | "x": 0, 834 | "y": 0 835 | }, 836 | "_fillStart": 0, 837 | "_fillRange": 0, 838 | "_isTrimmedMode": true, 839 | "_state": 0, 840 | "_atlas": null, 841 | "_id": "e7ZgHBZjFMhZIzpdtM5nb3" 842 | }, 843 | { 844 | "__type__": "cc.Node", 845 | "_name": "sun", 846 | "_objFlags": 0, 847 | "_parent": { 848 | "__id__": 2 849 | }, 850 | "_children": [], 851 | "_active": true, 852 | "_level": 1, 853 | "_components": [ 854 | { 855 | "__id__": 20 856 | } 857 | ], 858 | "_prefab": null, 859 | "_opacity": 255, 860 | "_color": { 861 | "__type__": "cc.Color", 862 | "r": 255, 863 | "g": 255, 864 | "b": 255, 865 | "a": 255 866 | }, 867 | "_contentSize": { 868 | "__type__": "cc.Size", 869 | "width": 410, 870 | "height": 410 871 | }, 872 | "_anchorPoint": { 873 | "__type__": "cc.Vec2", 874 | "x": 0.5, 875 | "y": 0.5 876 | }, 877 | "_position": { 878 | "__type__": "cc.Vec3", 879 | "x": 742, 880 | "y": 269, 881 | "z": 0 882 | }, 883 | "_scale": { 884 | "__type__": "cc.Vec3", 885 | "x": 0.5, 886 | "y": 0.5, 887 | "z": 1 888 | }, 889 | "_rotationX": 0, 890 | "_rotationY": 0, 891 | "_quat": { 892 | "__type__": "cc.Quat", 893 | "x": 0, 894 | "y": 0, 895 | "z": 0, 896 | "w": 1 897 | }, 898 | "_skewX": 0, 899 | "_skewY": 0, 900 | "_zIndex": 0, 901 | "groupIndex": 3, 902 | "_id": "3allQbwQZCpbJOgCKnScmc" 903 | }, 904 | { 905 | "__type__": "cc.Sprite", 906 | "_name": "", 907 | "_objFlags": 0, 908 | "node": { 909 | "__id__": 19 910 | }, 911 | "_enabled": true, 912 | "_srcBlendFactor": 770, 913 | "_dstBlendFactor": 771, 914 | "_spriteFrame": { 915 | "__uuid__": "3ad18be8-6c4a-4754-8c1a-2b3291ea64c4" 916 | }, 917 | "_type": 0, 918 | "_sizeMode": 1, 919 | "_fillType": 0, 920 | "_fillCenter": { 921 | "__type__": "cc.Vec2", 922 | "x": 0, 923 | "y": 0 924 | }, 925 | "_fillStart": 0, 926 | "_fillRange": 0, 927 | "_isTrimmedMode": true, 928 | "_state": 0, 929 | "_atlas": null, 930 | "_id": "34UdtwF0hCBpBnKqOsWUvF" 931 | }, 932 | { 933 | "__type__": "cc.Node", 934 | "_name": "player", 935 | "_objFlags": 0, 936 | "_parent": { 937 | "__id__": 2 938 | }, 939 | "_children": [], 940 | "_active": true, 941 | "_level": 1, 942 | "_components": [ 943 | { 944 | "__id__": 22 945 | }, 946 | { 947 | "__id__": 23 948 | } 949 | ], 950 | "_prefab": null, 951 | "_opacity": 255, 952 | "_color": { 953 | "__type__": "cc.Color", 954 | "r": 255, 955 | "g": 255, 956 | "b": 255, 957 | "a": 255 958 | }, 959 | "_contentSize": { 960 | "__type__": "cc.Size", 961 | "width": 290, 962 | "height": 384 963 | }, 964 | "_anchorPoint": { 965 | "__type__": "cc.Vec2", 966 | "x": 0.5, 967 | "y": 0.5 968 | }, 969 | "_position": { 970 | "__type__": "cc.Vec3", 971 | "x": -240.18, 972 | "y": -121.534, 973 | "z": 0 974 | }, 975 | "_scale": { 976 | "__type__": "cc.Vec3", 977 | "x": 1, 978 | "y": 1, 979 | "z": 1 980 | }, 981 | "_rotationX": 0, 982 | "_rotationY": 0, 983 | "_quat": { 984 | "__type__": "cc.Quat", 985 | "x": 0, 986 | "y": 0, 987 | "z": 0, 988 | "w": 1 989 | }, 990 | "_skewX": 0, 991 | "_skewY": 0, 992 | "_zIndex": 0, 993 | "groupIndex": 4, 994 | "_id": "68eWyJV0pG0q7aBzTGj/kl" 995 | }, 996 | { 997 | "__type__": "cc.Sprite", 998 | "_name": "", 999 | "_objFlags": 0, 1000 | "node": { 1001 | "__id__": 21 1002 | }, 1003 | "_enabled": true, 1004 | "_srcBlendFactor": 770, 1005 | "_dstBlendFactor": 771, 1006 | "_spriteFrame": { 1007 | "__uuid__": "87600be9-dd83-4e43-8a86-1ea82f76dfe2" 1008 | }, 1009 | "_type": 0, 1010 | "_sizeMode": 1, 1011 | "_fillType": 0, 1012 | "_fillCenter": { 1013 | "__type__": "cc.Vec2", 1014 | "x": 0, 1015 | "y": 0 1016 | }, 1017 | "_fillStart": 0, 1018 | "_fillRange": 0, 1019 | "_isTrimmedMode": true, 1020 | "_state": 0, 1021 | "_atlas": null, 1022 | "_id": "5eSzYlBKRO3ZauuwYRJCks" 1023 | }, 1024 | { 1025 | "__type__": "cc.Animation", 1026 | "_name": "", 1027 | "_objFlags": 0, 1028 | "node": { 1029 | "__id__": 21 1030 | }, 1031 | "_enabled": true, 1032 | "_defaultClip": { 1033 | "__uuid__": "0865a67e-28aa-4d8d-ac7a-65c58d2ca116" 1034 | }, 1035 | "_clips": [ 1036 | { 1037 | "__uuid__": "0865a67e-28aa-4d8d-ac7a-65c58d2ca116" 1038 | } 1039 | ], 1040 | "playOnLoad": true, 1041 | "_id": "37zNA7AjNEe51updeEGUcf" 1042 | }, 1043 | { 1044 | "__type__": "cc.Canvas", 1045 | "_name": "", 1046 | "_objFlags": 0, 1047 | "node": { 1048 | "__id__": 2 1049 | }, 1050 | "_enabled": true, 1051 | "_designResolution": { 1052 | "__type__": "cc.Size", 1053 | "width": 1920, 1054 | "height": 1024 1055 | }, 1056 | "_fitWidth": false, 1057 | "_fitHeight": true, 1058 | "_id": "430ZsmplZOxrqHwHHCK583" 1059 | }, 1060 | { 1061 | "__type__": "179dfUEArtG97Ve21VKer2x", 1062 | "_name": "", 1063 | "_objFlags": 0, 1064 | "node": { 1065 | "__id__": 2 1066 | }, 1067 | "_enabled": true, 1068 | "farCamera": { 1069 | "__id__": 6 1070 | }, 1071 | "nearCamera": { 1072 | "__id__": 8 1073 | }, 1074 | "bg01": { 1075 | "__id__": 12 1076 | }, 1077 | "bg02": { 1078 | "__id__": 14 1079 | }, 1080 | "nearbg01": { 1081 | "__id__": 16 1082 | }, 1083 | "nearbg02": { 1084 | "__id__": 18 1085 | }, 1086 | "_id": "77vlfqsVtJhobkaL9aeEHf" 1087 | } 1088 | ] -------------------------------------------------------------------------------- /assets/Scene/Camera.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Script.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Script/Game.ts: -------------------------------------------------------------------------------- 1 | 2 | const { ccclass, property } = cc._decorator; 3 | 4 | @ccclass 5 | export default class Game extends cc.Component { 6 | 7 | // 远景摄像机 8 | @property(cc.Camera) 9 | farCamera: cc.Camera = null; 10 | 11 | // 近景摄像机 12 | @property(cc.Camera) 13 | nearCamera: cc.Camera = null; 14 | 15 | @property(cc.Sprite) 16 | bg01: cc.Sprite = null; 17 | 18 | @property(cc.Sprite) 19 | bg02: cc.Sprite = null; 20 | 21 | // 地板 22 | @property(cc.Sprite) 23 | nearbg01: cc.Sprite = null; 24 | 25 | @property(cc.Sprite) 26 | nearbg02: cc.Sprite = null; 27 | 28 | 29 | farCount = 1; 30 | nearCount = 1; 31 | 32 | farSpeed = 30; 33 | nearSpeed = 300; 34 | 35 | start() { 36 | 37 | } 38 | 39 | onLoad() { 40 | } 41 | update(dt) { 42 | // 更新摄像机 43 | this.updateFarCamera(dt) 44 | this.updateNearCamera(dt); 45 | 46 | 47 | } 48 | 49 | updateFarCamera(dt:number) { 50 | this.farCamera.node.x += dt*this.farSpeed; 51 | let yu = this.farCount % 2; 52 | if (yu == 1) { 53 | if (this.farCamera.node.x > this.farCount * this.bg01.node.width) { 54 | this.bg01.node.x = (this.farCount+1) * this.bg01.node.width; 55 | this.farCount++; 56 | } 57 | } else { 58 | if (this.farCamera.node.x > this.farCount * this.bg01.node.width) { 59 | this.bg02.node.x = (this.farCount+1) * this.bg01.node.width; 60 | this.farCount++; 61 | } 62 | } 63 | } 64 | 65 | updateNearCamera(dt: number) { 66 | this.nearCamera.node.x += dt*this.nearSpeed; 67 | let yu = this.nearCount % 2; 68 | if (yu == 1) { 69 | if (this.nearCamera.node.x > this.nearCount * this.nearbg01.node.width) { 70 | this.nearbg01.node.x = (this.nearCount+1) * this.nearbg01.node.width; 71 | this.nearCount++; 72 | } 73 | } else { 74 | if (this.nearCamera.node.x > this.nearCount * this.nearbg02.node.width) { 75 | this.nearbg02.node.x = (this.nearCount+1) * this.nearbg02.node.width; 76 | this.nearCount++; 77 | } 78 | } 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /assets/Script/Game.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "179df504-02bb-46f7-b55e-db554a7abdb1", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/Texture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Texture/bg_01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/Texture/bg_01@2x.png -------------------------------------------------------------------------------- /assets/Texture/bg_01@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "4d82771c-4aa5-410f-bb4e-789a7052b36b", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "bg_01@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "bbbdd15a-39ca-4769-b1da-8b11937373e7", 12 | "rawTextureUuid": "4d82771c-4aa5-410f-bb4e-789a7052b36b", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 2048, 21 | "height": 1024, 22 | "rawWidth": 2048, 23 | "rawHeight": 1024, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Texture/singleColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/Texture/singleColor.png -------------------------------------------------------------------------------- /assets/Texture/singleColor.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "singleColor": { 10 | "ver": "1.0.3", 11 | "uuid": "410fb916-8721-4663-bab8-34397391ace7", 12 | "rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 2, 21 | "height": 2, 22 | "rawWidth": 2, 23 | "rawHeight": 2, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Texture/sun@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/Texture/sun@2x.png -------------------------------------------------------------------------------- /assets/Texture/sun@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "4536973c-f274-460a-81ad-8b04aa188d42", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "sun@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "3ad18be8-6c4a-4754-8c1a-2b3291ea64c4", 12 | "rawTextureUuid": "4536973c-f274-460a-81ad-8b04aa188d42", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 410, 21 | "height": 410, 22 | "rawWidth": 410, 23 | "rawHeight": 410, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/Texture/theme_front_01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/Texture/theme_front_01@2x.png -------------------------------------------------------------------------------- /assets/Texture/theme_front_01@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "aafc45a6-a160-4600-9864-76965e41c78c", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "theme_front_01@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "4cade94e-9aee-432e-abeb-024583e7b108", 12 | "rawTextureUuid": "aafc45a6-a160-4600-9864-76965e41c78c", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 2048, 21 | "height": 208, 22 | "rawWidth": 2048, 23 | "rawHeight": 208, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/resources.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "70a5842d-6ac1-40fa-b953-40c273a93e86", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_01@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/resources/idle_babarian_run_01@2x.png -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_01@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "ea8a7fe0-7206-49b7-bddf-abc79a247fd3", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "idle_babarian_run_01@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "87600be9-dd83-4e43-8a86-1ea82f76dfe2", 12 | "rawTextureUuid": "ea8a7fe0-7206-49b7-bddf-abc79a247fd3", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": -6, 17 | "offsetY": 5, 18 | "trimX": 1, 19 | "trimY": 1, 20 | "width": 290, 21 | "height": 384, 22 | "rawWidth": 304, 23 | "rawHeight": 396, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_02@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/resources/idle_babarian_run_02@2x.png -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_02@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "743e3896-f41b-4ec0-b038-89a680829fb4", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "idle_babarian_run_02@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "fcc39845-730a-450c-b239-d9f23b6b1df7", 12 | "rawTextureUuid": "743e3896-f41b-4ec0-b038-89a680829fb4", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": -2, 17 | "offsetY": 7, 18 | "trimX": 1, 19 | "trimY": 0, 20 | "width": 298, 21 | "height": 382, 22 | "rawWidth": 304, 23 | "rawHeight": 396, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_03@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/resources/idle_babarian_run_03@2x.png -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_03@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "a4cc1114-9a2e-499c-b6e8-100d5579abeb", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "idle_babarian_run_03@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "3e9f2ef8-6741-4c41-bd1e-de998cc14890", 12 | "rawTextureUuid": "a4cc1114-9a2e-499c-b6e8-100d5579abeb", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": -6, 17 | "offsetY": 0, 18 | "trimX": 1, 19 | "trimY": 1, 20 | "width": 290, 21 | "height": 394, 22 | "rawWidth": 304, 23 | "rawHeight": 396, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_04@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/resources/idle_babarian_run_04@2x.png -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_04@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "bf5c7d8b-959c-4991-9c2d-46f10f020466", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "idle_babarian_run_04@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "23805987-6a5b-4fb7-9f4b-2f73ca464747", 12 | "rawTextureUuid": "bf5c7d8b-959c-4991-9c2d-46f10f020466", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": -6, 17 | "offsetY": 5.5, 18 | "trimX": 1, 19 | "trimY": 1, 20 | "width": 290, 21 | "height": 383, 22 | "rawWidth": 304, 23 | "rawHeight": 396, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_05@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/assets/resources/idle_babarian_run_05@2x.png -------------------------------------------------------------------------------- /assets/resources/idle_babarian_run_05@2x.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "2ff40b37-5c4e-4b58-9acd-657a1516f04c", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "idle_babarian_run_05@2x": { 10 | "ver": "1.0.3", 11 | "uuid": "a74b8261-7e2f-4548-a38f-10b82cc4475a", 12 | "rawTextureUuid": "2ff40b37-5c4e-4b58-9acd-657a1516f04c", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 6.5, 18 | "trimX": 1, 19 | "trimY": 0, 20 | "width": 302, 21 | "height": 383, 22 | "rawWidth": 304, 23 | "rawHeight": 396, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /assets/resources/player_run.anim: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.AnimationClip", 3 | "_name": "player_run", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_duration": 0.6, 7 | "sample": 15, 8 | "speed": 1, 9 | "wrapMode": 2, 10 | "curveData": { 11 | "comps": { 12 | "cc.Sprite": { 13 | "spriteFrame": [ 14 | { 15 | "frame": 0, 16 | "value": { 17 | "__uuid__": "fcc39845-730a-450c-b239-d9f23b6b1df7" 18 | } 19 | }, 20 | { 21 | "frame": 0.13333333333333333, 22 | "value": { 23 | "__uuid__": "87600be9-dd83-4e43-8a86-1ea82f76dfe2" 24 | } 25 | }, 26 | { 27 | "frame": 0.26666666666666666, 28 | "value": { 29 | "__uuid__": "a74b8261-7e2f-4548-a38f-10b82cc4475a" 30 | } 31 | }, 32 | { 33 | "frame": 0.4, 34 | "value": { 35 | "__uuid__": "23805987-6a5b-4fb7-9f4b-2f73ca464747" 36 | } 37 | }, 38 | { 39 | "frame": 0.5333333333333333, 40 | "value": { 41 | "__uuid__": "3e9f2ef8-6741-4c41-bd1e-de998cc14890" 42 | } 43 | } 44 | ] 45 | } 46 | } 47 | }, 48 | "events": [] 49 | } -------------------------------------------------------------------------------- /assets/resources/player_run.anim.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "0865a67e-28aa-4d8d-ac7a-65c58d2ca116", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /camerashots/addcamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/addcamera.png -------------------------------------------------------------------------------- /camerashots/addcamera.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "f3a1eb58-41b1-436a-a565-e973e62b7c5a", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "addcamera": { 10 | "ver": "1.0.3", 11 | "uuid": "71a93c70-4440-4992-b2f1-4853bff28eea", 12 | "rawTextureUuid": "f3a1eb58-41b1-436a-a565-e973e62b7c5a", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 466, 21 | "height": 520, 22 | "rawWidth": 466, 23 | "rawHeight": 520, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/addgroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/addgroup.png -------------------------------------------------------------------------------- /camerashots/addgroup.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "56de0dc3-8a14-4b55-b07f-1574c221ae90", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "addgroup": { 10 | "ver": "1.0.3", 11 | "uuid": "59381c49-0238-4ce2-9c98-a814dab252da", 12 | "rawTextureUuid": "56de0dc3-8a14-4b55-b07f-1574c221ae90", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 600, 21 | "height": 565, 22 | "rawWidth": 600, 23 | "rawHeight": 565, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/camera-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/camera-demo.gif -------------------------------------------------------------------------------- /camerashots/camera.md: -------------------------------------------------------------------------------- 1 | # Camera 摄像机详解 2 | *作者:大掌教* 3 | 4 | *Q群:704391772* 5 | 6 | **直播课地址:** [https://ke.qq.com/course/378768?tuin=3ce6693]( https://ke.qq.com/course/378768?tuin=3ce6693 ) 7 | 8 | 9 | Creator从2.0开始发生了巨大变化,其中最大的变化莫过于Camera组件。为什么说最大的改变是Camera组件,因为这是一个全新的组件,将游戏世界的渲染窗口暴露出来,这将是引擎从2d渲染向3d渲染的关键。 10 | 11 | Camera是游戏渲染的窗口,场景里至少需要一个Camera,否则将无法渲染任何对象,世界将是一片黑暗。 12 | 13 | ### 要点 14 | - 一个场景至少需要一个Camera,可以同时存在多个Camera。 15 | - Camera本身不可见,渲染大小就是当前屏幕大小。 16 | - 同一场景可以多个Camera可以分组渲染,各自渲染各自的分组对象。 17 | - 多个Camera渲染的对象层次,由Camera深度Depth决定,值越大越后面渲染。同一个Camera渲染的对象,按照节点本身层级渲染,子节点总是在父节点后渲染。 18 | 19 | ## Camera案例——无限滚动视差背景 20 | Camera组件属性可参考[官方文档](https://docs.cocos.com/creator/manual/zh/render/camera.html#摄像机属性)。 21 | 22 | ### 分组渲染 23 | 24 | Creator编辑器在菜单`项目`->`项目设置`->`分组管理`中更改或添加。物理碰撞的分组管理也是这里设置的。 25 | 26 | 要实现分组渲染,首先需要在场景添加多个Camera,然后再分组管理添加多个分组,然后设置Camera的cullingMask属性为对应的分组。 27 | 28 | 1. 创建Camera节点,先创建一个空节点,然后在这个节点上添加Camera组件。添加两个Cameara节点,FarCamera和NearCamera,用来分别渲染远景和近景。 29 | 30 | ![空节点](node.png)
31 | ![添加摄像机](addcamera.png) 32 | 33 | 2. 添加分组,在分组管理里面添加两个分组,nearbg和farbg 34 | 35 | ![添加分组](addgroup.png) 36 | 37 | 3. 场景中添加近景和远景节点,分别设置Group 38 | 39 | ![远景](fargroup.png) 40 | 41 | ![近景](neargroup.png) 42 | 43 | 4. 设置Camera的cullMask为对应分组,FarCamera设置为farbg,NearCamera设置为nearbg。 44 | 45 | ![远景摄像机](farcamera.png) 46 | 47 | ![近景摄像机](nearcamera.png) 48 | 49 | 到这里多摄像机和分组渲染设置完成了,运行模拟器可以看到界面 50 | ![运行结果](step1.png) 51 | 52 | ### 视差原理 53 | 背景图片固定不动,移动摄像机。因为我们看到的画面都是摄像机渲染的画面,渲染区域就是屏幕大小。由于运动的相对性,我们观察的视角就是摄像机视角,和摄像机同步,背景图片就相对向相反方向移动。 54 | 55 | ![原理一](crude.png) 56 | 57 | 如图,由于横向不断移动,所以要做两个背景图,不断交替设置位置。 58 | ![原理一](crude2.png) 59 | 60 | 同样的原理,再设置一个近景,两组Camera移动的速度设置的不一致,就实现了无限滚动视差背景。 61 | 62 | ### 静景 63 | 有一些元素是不动的,比如太阳,月亮,挂在天上,如何实现? 64 | 65 | 新增分组celestial,将MainCamera开启,然后设置cullingMask为celestial,添加一个sun节点,分组设为celestial。 66 | 67 | 最终效果: 68 | ![原理一](camera-demo.gif) 69 | 70 | **Demo源码地址:** [https://github.com/fylz1125/CreatorDocuments](https://github.com/fylz1125/CreatorDocuments) 71 | 72 | # 更多Creator教程 73 | 2.0开始,新增了很多新特性,引擎发生了很大变化,后续将会分享更多干货。另外,每晚21:00,我将会在腾讯课堂直播讲解Creator游戏开发技术与实战经验,欢迎感兴趣的开发者关注。 74 | 75 | **直播地址:** [https://ke.qq.com/course/378768?tuin=3ce6693]( https://ke.qq.com/course/378768?tuin=3ce6693 ) -------------------------------------------------------------------------------- /camerashots/crude.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/crude.png -------------------------------------------------------------------------------- /camerashots/crude.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "3814ab04-2173-4826-9e01-176f25031379", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "crude": { 10 | "ver": "1.0.3", 11 | "uuid": "eef4a5eb-6ce0-47e7-8967-4ba18962e18c", 12 | "rawTextureUuid": "3814ab04-2173-4826-9e01-176f25031379", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 935, 21 | "height": 553, 22 | "rawWidth": 935, 23 | "rawHeight": 553, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/crude2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/crude2.png -------------------------------------------------------------------------------- /camerashots/crude2.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "9dd66143-55fc-41e4-a82a-8597f81b27a1", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "crude2": { 10 | "ver": "1.0.3", 11 | "uuid": "39fbd318-00a3-480f-91a5-d1e082c2ad69", 12 | "rawTextureUuid": "9dd66143-55fc-41e4-a82a-8597f81b27a1", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 1392, 21 | "height": 764, 22 | "rawWidth": 1392, 23 | "rawHeight": 764, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/demo.gif -------------------------------------------------------------------------------- /camerashots/farcamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/farcamera.png -------------------------------------------------------------------------------- /camerashots/farcamera.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "eba0d293-0026-4400-9b10-17a1c43ec8b3", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "farcamera": { 10 | "ver": "1.0.3", 11 | "uuid": "c8bfa673-e9fe-4a4c-b812-2f6ae656e5dd", 12 | "rawTextureUuid": "eba0d293-0026-4400-9b10-17a1c43ec8b3", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 1020, 21 | "height": 580, 22 | "rawWidth": 1020, 23 | "rawHeight": 580, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/fargroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/fargroup.png -------------------------------------------------------------------------------- /camerashots/fargroup.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "b06b74f5-c4ab-40ca-a029-c4c35b0b0d19", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "fargroup": { 10 | "ver": "1.0.3", 11 | "uuid": "ac067c16-3dc7-4f40-87f6-4c124eadb24f", 12 | "rawTextureUuid": "b06b74f5-c4ab-40ca-a029-c4c35b0b0d19", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 1023, 21 | "height": 531, 22 | "rawWidth": 1023, 23 | "rawHeight": 531, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/nearcamera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/nearcamera.png -------------------------------------------------------------------------------- /camerashots/nearcamera.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "3e289499-d7f0-4b87-8d60-d8b7311eb2b6", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "nearcamera": { 10 | "ver": "1.0.3", 11 | "uuid": "2de05dc9-4fdc-4a9e-bfad-1585fb0188a7", 12 | "rawTextureUuid": "3e289499-d7f0-4b87-8d60-d8b7311eb2b6", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 1025, 21 | "height": 580, 22 | "rawWidth": 1025, 23 | "rawHeight": 580, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/neargroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/neargroup.png -------------------------------------------------------------------------------- /camerashots/neargroup.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "81e75120-7dde-4593-ae59-84578ffdddfe", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "neargroup": { 10 | "ver": "1.0.3", 11 | "uuid": "5aead9d2-d68a-400c-975e-c92611217913", 12 | "rawTextureUuid": "81e75120-7dde-4593-ae59-84578ffdddfe", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 1019, 21 | "height": 421, 22 | "rawWidth": 1019, 23 | "rawHeight": 421, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/node.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/node.png -------------------------------------------------------------------------------- /camerashots/node.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "c7ae3b81-d506-45da-8cd1-9eb92ac571f0", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "node": { 10 | "ver": "1.0.3", 11 | "uuid": "c8e79238-2a00-4cfc-a107-bb37d51b65a5", 12 | "rawTextureUuid": "c7ae3b81-d506-45da-8cd1-9eb92ac571f0", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 238, 21 | "height": 288, 22 | "rawWidth": 238, 23 | "rawHeight": 288, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /camerashots/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/camerashots/step1.png -------------------------------------------------------------------------------- /camerashots/step1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "230addc0-2691-46e1-9390-4a3f900d99e8", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "step1": { 10 | "ver": "1.0.3", 11 | "uuid": "4adb7a04-8681-4724-b3d2-8a5c74270456", 12 | "rawTextureUuid": "230addc0-2691-46e1-9390-4a3f900d99e8", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 976, 21 | "height": 579, 22 | "rawWidth": 976, 23 | "rawHeight": 579, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "experimentalDecorators": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | ".vscode", 10 | "library", 11 | "local", 12 | "settings", 13 | "temp" 14 | ] 15 | } -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos2d-html5", 3 | "packages": "packages" 4 | } -------------------------------------------------------------------------------- /settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "excludeScenes": [], 3 | "orientation": { 4 | "landscapeLeft": true, 5 | "landscapeRight": true, 6 | "portrait": false, 7 | "upsideDown": false 8 | }, 9 | "packageName": "org.cocos2d.helloworld", 10 | "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49", 11 | "title": "hello_world", 12 | "webOrientation": "auto" 13 | } -------------------------------------------------------------------------------- /settings/builder.panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "excludeScenes": [], 3 | "packageName": "org.cocos2d.helloworld", 4 | "platform": "web-mobile", 5 | "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49", 6 | "title": "HelloWorld" 7 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "cocos-analytics": { 3 | "appID": "13798", 4 | "appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2", 5 | "channel": "", 6 | "enable": false, 7 | "version": "" 8 | }, 9 | "collision-matrix": [ 10 | [ 11 | true 12 | ], 13 | [ 14 | false, 15 | false 16 | ], 17 | [ 18 | false, 19 | false, 20 | false 21 | ], 22 | [ 23 | false, 24 | false, 25 | false, 26 | false 27 | ], 28 | [ 29 | false, 30 | false, 31 | false, 32 | false, 33 | false 34 | ] 35 | ], 36 | "design-resolution-height": 640, 37 | "design-resolution-width": 960, 38 | "excluded-modules": [], 39 | "facebook": { 40 | "appID": "", 41 | "audience": { 42 | "enable": false 43 | }, 44 | "enable": false, 45 | "live": { 46 | "enable": false 47 | } 48 | }, 49 | "fit-height": true, 50 | "fit-width": false, 51 | "group-list": [ 52 | "default", 53 | "nearbg", 54 | "farbg", 55 | "celestial", 56 | "player" 57 | ], 58 | "last-module-event-record-time": 0, 59 | "simulator-orientation": false, 60 | "simulator-resolution": { 61 | "height": 640, 62 | "width": 960 63 | }, 64 | "use-customize-simulator": false, 65 | "use-project-simulator-setting": false 66 | } -------------------------------------------------------------------------------- /settings/services.json: -------------------------------------------------------------------------------- 1 | { 2 | "services": [ 3 | { 4 | "service_id": "235", 5 | "service_name": "Cocos Analytics", 6 | "service_icon": "https://account.cocos.com/client/3f8f31ccf66995e183044f167c092395.png", 7 | "service_desc": "提供最核心最基本的数据、标准化界面功能简洁易用、数据准确性最好", 8 | "service_title": "精准了解游戏的新增、活跃、留存、付费等数据", 9 | "service_guide_url": "https://n-analytics.cocos.com/docs/", 10 | "service_sample_url": "https://github.com/cocos-creator/tutorial-dark-slash/tree/analytics", 11 | "service_dev_url": "http://analytics.cocos.com/realtime/jump_to/", 12 | "service_type": "3", 13 | "service_type_zh": "公司和个人游戏", 14 | "support_platform": [ 15 | "Android", 16 | "iOS", 17 | "HTML5" 18 | ], 19 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-analytics/1.1.7_2.0.3.zip", 20 | "package_version_desc": "1、 更新 H5 SDK 版本至 2.0.3。
2、 SDK 优化更新,删除 init 接口字段 'channel' ,改为 login 接口输入。
3、 如有相关问题咨询或者需求, 可以联系我们技术支持邮箱 support-cocos@cocos.com", 21 | "service_component_name": "service-analytics", 22 | "package_versions": [ 23 | "1.0.0_1.0.5", 24 | "1.1.2_2.0.0", 25 | "1.1.3_2.0.1", 26 | "1.1.4_2.0.1", 27 | "1.1.5_2.0.1", 28 | "1.1.6_2.0.1_2.0.2", 29 | "1.1.7_2.0.3" 30 | ], 31 | "build_platform": [ 32 | "web-mobile", 33 | "web-desktop", 34 | "fb-instant-games", 35 | "wechatgame", 36 | "wechatgame-subcontext", 37 | "qqplay", 38 | "android", 39 | "android-instant", 40 | "ios", 41 | "mac", 42 | "quickgame", 43 | "qgame", 44 | "huawei" 45 | ], 46 | "require_verify": 0, 47 | "service_price": "", 48 | "packpage_version_desc": "" 49 | }, 50 | { 51 | "service_id": "241", 52 | "service_name": "Matchvs", 53 | "service_icon": "https://account.cocos.com/client/14406719a07eb3d714d36e5edc6e06fa.png", 54 | "service_desc": "通过SDK接入快速实现联网功能、帧同步、国内外多节点、服务器独立部署、gameServer自定义游戏服务端逻辑。\n技术支持群QQ群:822523258", 55 | "service_title": "专业成熟的移动游戏联网与服务端解决方案", 56 | "service_guide_url": "http://doc.matchvs.com/QuickStart/QuickStart-CocosCreator", 57 | "service_sample_url": "http://www.matchvs.com/serviceCourse", 58 | "service_dev_url": "http://www.matchvs.com/cocosLogin", 59 | "service_type": "3", 60 | "service_type_zh": "公司和个人游戏", 61 | "support_platform": [ 62 | "Android", 63 | "iOS", 64 | "HTML5" 65 | ], 66 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-matchvs/1.0.7_3.7.9.6.zip", 67 | "package_version_desc": "更新日期:2019-05-15
更新内容:
1、调整getRoomListEx接口,获取系统创建房间
2、增加appkey等的校验
3、新增以下平台支持:
  • VIVO 小游戏
  • OPPO 小游戏
  • HUAWEI 快游戏
  • 百度小游戏(默认不支持,需修改代码强制开启WSS选项)", 68 | "service_component_name": "service-matchvs", 69 | "package_versions": [ 70 | "1.0.3_3.7.6.4", 71 | "1.0.5_3.7.7.3", 72 | "1.0.6_3.7.9.2", 73 | "1.0.7_3.7.9.6" 74 | ], 75 | "build_platform": [ 76 | "web-mobile", 77 | "web-desktop", 78 | "fb-instant-games", 79 | "wechatgame", 80 | "wechatgame-subcontext", 81 | "qqplay", 82 | "android", 83 | "android-instant", 84 | "ios", 85 | "mac", 86 | "quickgame", 87 | "qgame", 88 | "huawei" 89 | ], 90 | "require_verify": 0, 91 | "service_price": "", 92 | "packpage_version_desc": "" 93 | }, 94 | { 95 | "service_id": "242", 96 | "service_name": "Agora Voice", 97 | "service_icon": "https://account.cocos.com/uploads/client_icon/date(\"Y-m-d\")/50fe52b789c2fc1e1fff9eec161c1bb3.png", 98 | "service_desc": "稳定、低耗、76ms超低延时、全球200+数据中心覆盖;变声器、超高音质、听声辩位等丰富玩法极速接入;全平台支持:Android、iOS、Web。\n技术支持群QQ群:799099183\n", 99 | "service_title": "游戏内置实时语音", 100 | "service_guide_url": "https://docs.agora.io/cn/Interactive Gaming/game_c", 101 | "service_sample_url": " https://github.com/AgoraIO/Voice-Call-for-Mobile-Gaming/tree/master/Basic-Voice-Call-for-Gaming/Hello-Cocos-Creator-Voice-Agora", 102 | "service_dev_url": "https://sso.agora.io/api/oauth/cocos/login", 103 | "service_type": "3", 104 | "service_type_zh": "公司和个人游戏", 105 | "support_platform": [ 106 | "Android", 107 | "iOS", 108 | "HTML5" 109 | ], 110 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-agora/1.0.1_2.2.3.20_2.5.2.zip", 111 | "package_version_desc": "first release.", 112 | "service_component_name": "service-agora", 113 | "package_versions": [ 114 | "1.0.1_2.2.3.20_2.5.2" 115 | ], 116 | "build_platform": [ 117 | "web-mobile", 118 | "web-desktop", 119 | "android", 120 | "ios" 121 | ], 122 | "require_verify": 1, 123 | "service_price": "", 124 | "packpage_version_desc": "" 125 | }, 126 | { 127 | "service_id": "7", 128 | "service_name": "AnySDK", 129 | "service_icon": "https://account.cocos.com/client/3ba1fcf9029140cf08d95813e387d04a.png", 130 | "service_desc": "800+渠道、支持多平台多引擎、安全稳定的本地打包工具。技术支持:https://forum.cocos.com/c/anysdk", 131 | "service_title": "游戏快速接入第三方SDK的解决方案", 132 | "service_guide_url": "http://docs.anysdk.com", 133 | "service_sample_url": "http://github.com/AnySDK", 134 | "service_dev_url": "http://dev.anysdk.com", 135 | "service_type": "0", 136 | "service_type_zh": "不支持游戏", 137 | "support_platform": [ 138 | "Android", 139 | "iOS", 140 | "HTML5" 141 | ], 142 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-anysdk/1.0.1_2.2.5.zip", 143 | "package_version_desc": "修复 Creator 2.0.x 系列版本 2.0.7 以上因调用 cc.game.restart(); 而导致的 AnySDK 调用失败的错误", 144 | "service_component_name": "service-anysdk", 145 | "package_versions": [ 146 | "1.0.1_2.2.5" 147 | ], 148 | "build_platform": [ 149 | "web-mobile", 150 | "web-desktop", 151 | "android", 152 | "ios" 153 | ], 154 | "require_verify": 0, 155 | "service_price": "", 156 | "packpage_version_desc": "" 157 | } 158 | ] 159 | } -------------------------------------------------------------------------------- /template-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fylz1125/CreatorDocuments/ad76a2c10675bc71663a270d5df1d2c0a104190b/template-banner.png -------------------------------------------------------------------------------- /template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TEMPLATES.helloworld-ts.name", 3 | "desc": "TEMPLATES.helloworld-ts.desc", 4 | "banner": "template-banner.png" 5 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "lib": [ "dom", "es5", "es2015.promise" ], 5 | "target": "es5", 6 | "allowJs": true, 7 | "experimentalDecorators": true, 8 | "skipLibCheck": true 9 | }, 10 | "exclude": [ 11 | "node_modules", 12 | "library", 13 | "local", 14 | "temp", 15 | "build", 16 | "settings" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------