├── .gitignore ├── README.md ├── assets ├── camera.fire ├── camera.fire.meta ├── res.meta ├── res │ ├── texture.meta │ ├── texture │ │ ├── 1.png │ │ ├── 1.png.meta │ │ ├── Arc90_40.png │ │ ├── Arc90_40.png.meta │ │ ├── ArcEgg.png │ │ ├── ArcEgg.png.meta │ │ ├── Box20.png │ │ ├── Box20.png.meta │ │ ├── Box40.png │ │ ├── Box40.png.meta │ │ ├── Box80.png │ │ ├── Box80.png.meta │ │ ├── Circle20.png │ │ ├── Circle20.png.meta │ │ ├── Circle40.png │ │ ├── Circle40.png.meta │ │ ├── Circle80.png │ │ ├── Circle80.png.meta │ │ ├── LineArc90_40.png │ │ ├── LineArc90_40.png.meta │ │ ├── Platform160.png │ │ ├── Platform160.png.meta │ │ ├── Triangle20.png │ │ ├── Triangle20.png.meta │ │ ├── Triangle40.png │ │ ├── Triangle40.png.meta │ │ ├── gold.png │ │ ├── gold.png.meta │ │ ├── goldcoin.png │ │ ├── goldcoin.png.meta │ │ ├── spr_f_ayla.png │ │ ├── spr_f_ayla.png.meta │ │ ├── star.png │ │ └── star.png.meta │ ├── tiled.meta │ └── tiled │ │ ├── map.tmx │ │ └── map.tmx.meta ├── script.meta ├── script │ ├── CameraControl.js │ ├── CameraControl.js.meta │ ├── Global.js │ ├── Global.js.meta │ ├── HeroControl.js │ ├── HeroControl.js.meta │ ├── TweenLite.js │ ├── TweenLite.js.meta │ ├── easing.meta │ ├── easing │ │ ├── EasePack.js │ │ └── EasePack.js.meta │ ├── impulse.js │ └── impulse.js.meta ├── shake.anim └── shake.anim.meta ├── creator.d.ts ├── jsconfig.json ├── project.json └── settings └── project.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 Demo for Cocos Creator 2 | 3 | In this project we demonstrate how to control cc.Camera in your action/platform game. There're several scripts you want to take a look at: 4 | 5 | - `CameraControl.js`: Controls the camera's movement and zoom ratio according to your need. 6 | - `HeroControl.js`: Physics based player control script, borrowed from [Physics Example](https://github.com/2youyou2/physics-example) 7 | - `Global.js`: We enable physics system in this global script. 8 | 9 | ## Camera Control Pattern 10 | 11 | In `CameraControl` component we implemented following method to control camera: 12 | 13 | - **Smooth Follow**: follow the target smoothly when the target is too far away from camera. 14 | - **Speed Zoom**: Zoom out the camera when player moves fast. Zoom back in when player slow down. 15 | - **Jump Zoom**: The higher player jumps, the larger view he can see through camera. 16 | - **Overview**: aka multi-targets, the camera will show all listed target and automatically zoom out to fit all of them on screen. 17 | - **Camera Shake**: Use animation clip to move the camera node up and down for camera shake effect. 18 | - **Pointer Pan**: Move your mouse to pan the camera around the player. 19 | - **Boundaries**: Set boundaries for camera so it won't move across border. -------------------------------------------------------------------------------- /assets/camera.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_rawFiles": null, 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 | "__id__": 4 21 | }, 22 | { 23 | "__id__": 43 24 | }, 25 | { 26 | "__id__": 47 27 | } 28 | ], 29 | "_tag": -1, 30 | "_active": true, 31 | "_components": [], 32 | "_prefab": null, 33 | "_id": "531985b9-a63c-4d5b-abaa-b72e6aea1740", 34 | "_opacity": 255, 35 | "_color": { 36 | "__type__": "cc.Color", 37 | "r": 255, 38 | "g": 255, 39 | "b": 255, 40 | "a": 255 41 | }, 42 | "_cascadeOpacityEnabled": true, 43 | "_anchorPoint": { 44 | "__type__": "cc.Vec2", 45 | "x": 0, 46 | "y": 0 47 | }, 48 | "_contentSize": { 49 | "__type__": "cc.Size", 50 | "width": 0, 51 | "height": 0 52 | }, 53 | "_localZOrder": 0, 54 | "_globalZOrder": 0, 55 | "_opacityModifyRGB": false, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false 58 | }, 59 | { 60 | "__type__": "cc.Node", 61 | "_name": "Canvas", 62 | "_objFlags": 0, 63 | "_parent": { 64 | "__id__": 1 65 | }, 66 | "_children": [], 67 | "_tag": -1, 68 | "_active": true, 69 | "_components": [ 70 | { 71 | "__id__": 3 72 | } 73 | ], 74 | "_prefab": null, 75 | "_id": "b5e579GRk1PYpn9b49sRAHJ", 76 | "_opacity": 255, 77 | "_color": { 78 | "__type__": "cc.Color", 79 | "r": 255, 80 | "g": 255, 81 | "b": 255, 82 | "a": 255 83 | }, 84 | "_cascadeOpacityEnabled": true, 85 | "_anchorPoint": { 86 | "__type__": "cc.Vec2", 87 | "x": 0.5, 88 | "y": 0.5 89 | }, 90 | "_contentSize": { 91 | "__type__": "cc.Size", 92 | "width": 960, 93 | "height": 640 94 | }, 95 | "_rotationX": 0, 96 | "_rotationY": 0, 97 | "_scaleX": 1, 98 | "_scaleY": 1, 99 | "_position": { 100 | "__type__": "cc.Vec2", 101 | "x": 480, 102 | "y": 320 103 | }, 104 | "_skewX": 0, 105 | "_skewY": 0, 106 | "_localZOrder": 0, 107 | "_globalZOrder": 0, 108 | "_opacityModifyRGB": false, 109 | "groupIndex": 0 110 | }, 111 | { 112 | "__type__": "cc.Canvas", 113 | "_name": "", 114 | "_objFlags": 0, 115 | "node": { 116 | "__id__": 2 117 | }, 118 | "_enabled": true, 119 | "_designResolution": { 120 | "__type__": "cc.Size", 121 | "width": 960, 122 | "height": 640 123 | }, 124 | "_fitWidth": false, 125 | "_fitHeight": true 126 | }, 127 | { 128 | "__type__": "cc.Node", 129 | "_name": "Level", 130 | "_objFlags": 0, 131 | "_parent": { 132 | "__id__": 1 133 | }, 134 | "_children": [ 135 | { 136 | "__id__": 5 137 | }, 138 | { 139 | "__id__": 9 140 | }, 141 | { 142 | "__id__": 13 143 | }, 144 | { 145 | "__id__": 17 146 | }, 147 | { 148 | "__id__": 21 149 | }, 150 | { 151 | "__id__": 25 152 | }, 153 | { 154 | "__id__": 29 155 | }, 156 | { 157 | "__id__": 31 158 | }, 159 | { 160 | "__id__": 35 161 | }, 162 | { 163 | "__id__": 39 164 | } 165 | ], 166 | "_tag": -1, 167 | "_active": true, 168 | "_components": [], 169 | "_prefab": null, 170 | "_id": "e68885fDG5ImrP7+XVxSfZk", 171 | "_opacity": 255, 172 | "_color": { 173 | "__type__": "cc.Color", 174 | "r": 255, 175 | "g": 255, 176 | "b": 255, 177 | "a": 255 178 | }, 179 | "_cascadeOpacityEnabled": true, 180 | "_anchorPoint": { 181 | "__type__": "cc.Vec2", 182 | "x": 0.5, 183 | "y": 0.5 184 | }, 185 | "_contentSize": { 186 | "__type__": "cc.Size", 187 | "width": 0, 188 | "height": 0 189 | }, 190 | "_rotationX": 0, 191 | "_rotationY": 0, 192 | "_scaleX": 1, 193 | "_scaleY": 1, 194 | "_position": { 195 | "__type__": "cc.Vec2", 196 | "x": 0, 197 | "y": 0 198 | }, 199 | "_skewX": 0, 200 | "_skewY": 0, 201 | "_localZOrder": 0, 202 | "_globalZOrder": 0, 203 | "_opacityModifyRGB": false, 204 | "groupIndex": 0 205 | }, 206 | { 207 | "__type__": "cc.Node", 208 | "_name": "Box40", 209 | "_objFlags": 0, 210 | "_parent": { 211 | "__id__": 4 212 | }, 213 | "_children": [], 214 | "_tag": -1, 215 | "_active": true, 216 | "_components": [ 217 | { 218 | "__id__": 6 219 | }, 220 | { 221 | "__id__": 7 222 | }, 223 | { 224 | "__id__": 8 225 | } 226 | ], 227 | "_prefab": null, 228 | "_id": "55becoop1ZCQq5sxByga3KP", 229 | "_opacity": 255, 230 | "_color": { 231 | "__type__": "cc.Color", 232 | "r": 255, 233 | "g": 255, 234 | "b": 255, 235 | "a": 255 236 | }, 237 | "_cascadeOpacityEnabled": true, 238 | "_anchorPoint": { 239 | "__type__": "cc.Vec2", 240 | "x": 0.5, 241 | "y": 0.5 242 | }, 243 | "_contentSize": { 244 | "__type__": "cc.Size", 245 | "width": 205, 246 | "height": 41 247 | }, 248 | "_rotationX": 0, 249 | "_rotationY": 0, 250 | "_scaleX": 1, 251 | "_scaleY": 1, 252 | "_position": { 253 | "__type__": "cc.Vec2", 254 | "x": 857, 255 | "y": 127 256 | }, 257 | "_skewX": 0, 258 | "_skewY": 0, 259 | "_localZOrder": 0, 260 | "_globalZOrder": 0, 261 | "_opacityModifyRGB": false, 262 | "groupIndex": 0 263 | }, 264 | { 265 | "__type__": "cc.Sprite", 266 | "_name": "", 267 | "_objFlags": 0, 268 | "node": { 269 | "__id__": 5 270 | }, 271 | "_enabled": true, 272 | "_spriteFrame": { 273 | "__uuid__": "f0e04b54-1ca5-4fc6-b651-346dd79a7c19" 274 | }, 275 | "_type": 2, 276 | "_sizeMode": 0, 277 | "_fillType": 0, 278 | "_fillCenter": { 279 | "__type__": "cc.Vec2", 280 | "x": 0, 281 | "y": 0 282 | }, 283 | "_fillStart": 0, 284 | "_fillRange": 0, 285 | "_isTrimmedMode": true, 286 | "_srcBlendFactor": 770, 287 | "_dstBlendFactor": 771, 288 | "_atlas": null 289 | }, 290 | { 291 | "__type__": "cc.RigidBody", 292 | "_name": "", 293 | "_objFlags": 0, 294 | "node": { 295 | "__id__": 5 296 | }, 297 | "_enabled": true, 298 | "_type": 0, 299 | "_allowSleep": true, 300 | "_gravityScale": 1, 301 | "_linearDamping": 0, 302 | "_angularDamping": 0, 303 | "_linearVelocity": { 304 | "__type__": "cc.Vec2", 305 | "x": 0, 306 | "y": 0 307 | }, 308 | "_angularVelocity": 0, 309 | "_fixedRotation": false, 310 | "enabledContactListener": false, 311 | "bullet": false 312 | }, 313 | { 314 | "__type__": "cc.PhysicsBoxCollider", 315 | "_name": "", 316 | "_objFlags": 0, 317 | "node": { 318 | "__id__": 5 319 | }, 320 | "_enabled": true, 321 | "tag": 0, 322 | "_density": 1, 323 | "_sensor": false, 324 | "_friction": 0.2, 325 | "_restitution": 0, 326 | "body": null, 327 | "_offset": { 328 | "__type__": "cc.Vec2", 329 | "x": 0, 330 | "y": 0 331 | }, 332 | "_size": { 333 | "__type__": "cc.Size", 334 | "width": 205, 335 | "height": 41 336 | } 337 | }, 338 | { 339 | "__type__": "cc.Node", 340 | "_name": "Box20", 341 | "_objFlags": 0, 342 | "_parent": { 343 | "__id__": 4 344 | }, 345 | "_children": [], 346 | "_tag": -1, 347 | "_active": true, 348 | "_components": [ 349 | { 350 | "__id__": 10 351 | }, 352 | { 353 | "__id__": 11 354 | }, 355 | { 356 | "__id__": 12 357 | } 358 | ], 359 | "_prefab": null, 360 | "_id": "786cadWyUhL0YwyPOnbTOlY", 361 | "_opacity": 255, 362 | "_color": { 363 | "__type__": "cc.Color", 364 | "r": 255, 365 | "g": 255, 366 | "b": 255, 367 | "a": 255 368 | }, 369 | "_cascadeOpacityEnabled": true, 370 | "_anchorPoint": { 371 | "__type__": "cc.Vec2", 372 | "x": 0, 373 | "y": 0 374 | }, 375 | "_contentSize": { 376 | "__type__": "cc.Size", 377 | "width": 600, 378 | "height": 250 379 | }, 380 | "_rotationX": 0, 381 | "_rotationY": 0, 382 | "_scaleX": 1, 383 | "_scaleY": 1, 384 | "_position": { 385 | "__type__": "cc.Vec2", 386 | "x": 0, 387 | "y": 0 388 | }, 389 | "_skewX": 0, 390 | "_skewY": 0, 391 | "_localZOrder": 0, 392 | "_globalZOrder": 0, 393 | "_opacityModifyRGB": false, 394 | "groupIndex": 0 395 | }, 396 | { 397 | "__type__": "cc.Sprite", 398 | "_name": "", 399 | "_objFlags": 0, 400 | "node": { 401 | "__id__": 9 402 | }, 403 | "_enabled": true, 404 | "_spriteFrame": { 405 | "__uuid__": "0bcbdfa9-8ea8-4806-88e1-72e7c61dce1b" 406 | }, 407 | "_type": 1, 408 | "_sizeMode": 0, 409 | "_fillType": 0, 410 | "_fillCenter": { 411 | "__type__": "cc.Vec2", 412 | "x": 0, 413 | "y": 0 414 | }, 415 | "_fillStart": 0, 416 | "_fillRange": 0, 417 | "_isTrimmedMode": true, 418 | "_srcBlendFactor": 770, 419 | "_dstBlendFactor": 771, 420 | "_atlas": null 421 | }, 422 | { 423 | "__type__": "cc.RigidBody", 424 | "_name": "", 425 | "_objFlags": 0, 426 | "node": { 427 | "__id__": 9 428 | }, 429 | "_enabled": true, 430 | "_type": 0, 431 | "_allowSleep": true, 432 | "_gravityScale": 1, 433 | "_linearDamping": 0, 434 | "_angularDamping": 0, 435 | "_linearVelocity": { 436 | "__type__": "cc.Vec2", 437 | "x": 0, 438 | "y": 0 439 | }, 440 | "_angularVelocity": 0, 441 | "_fixedRotation": false, 442 | "enabledContactListener": false, 443 | "bullet": false 444 | }, 445 | { 446 | "__type__": "cc.PhysicsBoxCollider", 447 | "_name": "", 448 | "_objFlags": 0, 449 | "node": { 450 | "__id__": 9 451 | }, 452 | "_enabled": true, 453 | "tag": 0, 454 | "_density": 1, 455 | "_sensor": false, 456 | "_friction": 0.2, 457 | "_restitution": 0, 458 | "body": null, 459 | "_offset": { 460 | "__type__": "cc.Vec2", 461 | "x": 300, 462 | "y": 125 463 | }, 464 | "_size": { 465 | "__type__": "cc.Size", 466 | "width": 600, 467 | "height": 250 468 | } 469 | }, 470 | { 471 | "__type__": "cc.Node", 472 | "_name": "Box20", 473 | "_objFlags": 0, 474 | "_parent": { 475 | "__id__": 4 476 | }, 477 | "_children": [], 478 | "_tag": -1, 479 | "_active": true, 480 | "_components": [ 481 | { 482 | "__id__": 14 483 | }, 484 | { 485 | "__id__": 15 486 | }, 487 | { 488 | "__id__": 16 489 | } 490 | ], 491 | "_prefab": null, 492 | "_id": "775a1IwnfNPuog4S74U87gK", 493 | "_opacity": 255, 494 | "_color": { 495 | "__type__": "cc.Color", 496 | "r": 255, 497 | "g": 255, 498 | "b": 255, 499 | "a": 255 500 | }, 501 | "_cascadeOpacityEnabled": true, 502 | "_anchorPoint": { 503 | "__type__": "cc.Vec2", 504 | "x": 0, 505 | "y": 0 506 | }, 507 | "_contentSize": { 508 | "__type__": "cc.Size", 509 | "width": 319, 510 | "height": 438 511 | }, 512 | "_rotationX": 0, 513 | "_rotationY": 0, 514 | "_scaleX": 1, 515 | "_scaleY": 1, 516 | "_position": { 517 | "__type__": "cc.Vec2", 518 | "x": 1365, 519 | "y": 0 520 | }, 521 | "_skewX": 0, 522 | "_skewY": 0, 523 | "_localZOrder": 0, 524 | "_globalZOrder": 0, 525 | "_opacityModifyRGB": false, 526 | "groupIndex": 0 527 | }, 528 | { 529 | "__type__": "cc.Sprite", 530 | "_name": "", 531 | "_objFlags": 0, 532 | "node": { 533 | "__id__": 13 534 | }, 535 | "_enabled": true, 536 | "_spriteFrame": { 537 | "__uuid__": "0bcbdfa9-8ea8-4806-88e1-72e7c61dce1b" 538 | }, 539 | "_type": 1, 540 | "_sizeMode": 0, 541 | "_fillType": 0, 542 | "_fillCenter": { 543 | "__type__": "cc.Vec2", 544 | "x": 0, 545 | "y": 0 546 | }, 547 | "_fillStart": 0, 548 | "_fillRange": 0, 549 | "_isTrimmedMode": true, 550 | "_srcBlendFactor": 770, 551 | "_dstBlendFactor": 771, 552 | "_atlas": null 553 | }, 554 | { 555 | "__type__": "cc.RigidBody", 556 | "_name": "", 557 | "_objFlags": 0, 558 | "node": { 559 | "__id__": 13 560 | }, 561 | "_enabled": true, 562 | "_type": 0, 563 | "_allowSleep": true, 564 | "_gravityScale": 1, 565 | "_linearDamping": 0, 566 | "_angularDamping": 0, 567 | "_linearVelocity": { 568 | "__type__": "cc.Vec2", 569 | "x": 0, 570 | "y": 0 571 | }, 572 | "_angularVelocity": 0, 573 | "_fixedRotation": false, 574 | "enabledContactListener": false, 575 | "bullet": false 576 | }, 577 | { 578 | "__type__": "cc.PhysicsBoxCollider", 579 | "_name": "", 580 | "_objFlags": 0, 581 | "node": { 582 | "__id__": 13 583 | }, 584 | "_enabled": true, 585 | "tag": 0, 586 | "_density": 1, 587 | "_sensor": false, 588 | "_friction": 0.2, 589 | "_restitution": 0, 590 | "body": null, 591 | "_offset": { 592 | "__type__": "cc.Vec2", 593 | "x": 159.5, 594 | "y": 219 595 | }, 596 | "_size": { 597 | "__type__": "cc.Size", 598 | "width": 319, 599 | "height": 438 600 | } 601 | }, 602 | { 603 | "__type__": "cc.Node", 604 | "_name": "Box40", 605 | "_objFlags": 0, 606 | "_parent": { 607 | "__id__": 4 608 | }, 609 | "_children": [], 610 | "_tag": -1, 611 | "_active": true, 612 | "_components": [ 613 | { 614 | "__id__": 18 615 | }, 616 | { 617 | "__id__": 19 618 | }, 619 | { 620 | "__id__": 20 621 | } 622 | ], 623 | "_prefab": null, 624 | "_id": "5becbgOPx5EgpmO1XxMx7kG", 625 | "_opacity": 255, 626 | "_color": { 627 | "__type__": "cc.Color", 628 | "r": 255, 629 | "g": 255, 630 | "b": 255, 631 | "a": 255 632 | }, 633 | "_cascadeOpacityEnabled": true, 634 | "_anchorPoint": { 635 | "__type__": "cc.Vec2", 636 | "x": 0.5, 637 | "y": 0.5 638 | }, 639 | "_contentSize": { 640 | "__type__": "cc.Size", 641 | "width": 205, 642 | "height": 41 643 | }, 644 | "_rotationX": 0, 645 | "_rotationY": 0, 646 | "_scaleX": 1, 647 | "_scaleY": 1, 648 | "_position": { 649 | "__type__": "cc.Vec2", 650 | "x": 1161, 651 | "y": 221 652 | }, 653 | "_skewX": 0, 654 | "_skewY": 0, 655 | "_localZOrder": 0, 656 | "_globalZOrder": 0, 657 | "_opacityModifyRGB": false, 658 | "groupIndex": 0 659 | }, 660 | { 661 | "__type__": "cc.Sprite", 662 | "_name": "", 663 | "_objFlags": 0, 664 | "node": { 665 | "__id__": 17 666 | }, 667 | "_enabled": true, 668 | "_spriteFrame": { 669 | "__uuid__": "f0e04b54-1ca5-4fc6-b651-346dd79a7c19" 670 | }, 671 | "_type": 2, 672 | "_sizeMode": 0, 673 | "_fillType": 0, 674 | "_fillCenter": { 675 | "__type__": "cc.Vec2", 676 | "x": 0, 677 | "y": 0 678 | }, 679 | "_fillStart": 0, 680 | "_fillRange": 0, 681 | "_isTrimmedMode": true, 682 | "_srcBlendFactor": 770, 683 | "_dstBlendFactor": 771, 684 | "_atlas": null 685 | }, 686 | { 687 | "__type__": "cc.RigidBody", 688 | "_name": "", 689 | "_objFlags": 0, 690 | "node": { 691 | "__id__": 17 692 | }, 693 | "_enabled": true, 694 | "_type": 0, 695 | "_allowSleep": true, 696 | "_gravityScale": 1, 697 | "_linearDamping": 0, 698 | "_angularDamping": 0, 699 | "_linearVelocity": { 700 | "__type__": "cc.Vec2", 701 | "x": 0, 702 | "y": 0 703 | }, 704 | "_angularVelocity": 0, 705 | "_fixedRotation": false, 706 | "enabledContactListener": false, 707 | "bullet": false 708 | }, 709 | { 710 | "__type__": "cc.PhysicsBoxCollider", 711 | "_name": "", 712 | "_objFlags": 0, 713 | "node": { 714 | "__id__": 17 715 | }, 716 | "_enabled": true, 717 | "tag": 0, 718 | "_density": 1, 719 | "_sensor": false, 720 | "_friction": 0.2, 721 | "_restitution": 0, 722 | "body": null, 723 | "_offset": { 724 | "__type__": "cc.Vec2", 725 | "x": 0, 726 | "y": 0 727 | }, 728 | "_size": { 729 | "__type__": "cc.Size", 730 | "width": 205, 731 | "height": 41 732 | } 733 | }, 734 | { 735 | "__type__": "cc.Node", 736 | "_name": "Box40", 737 | "_objFlags": 0, 738 | "_parent": { 739 | "__id__": 4 740 | }, 741 | "_children": [], 742 | "_tag": -1, 743 | "_active": true, 744 | "_components": [ 745 | { 746 | "__id__": 22 747 | }, 748 | { 749 | "__id__": 23 750 | }, 751 | { 752 | "__id__": 24 753 | } 754 | ], 755 | "_prefab": null, 756 | "_id": "29790a3PglA6pI0f9RIAC+9", 757 | "_opacity": 255, 758 | "_color": { 759 | "__type__": "cc.Color", 760 | "r": 255, 761 | "g": 255, 762 | "b": 255, 763 | "a": 255 764 | }, 765 | "_cascadeOpacityEnabled": true, 766 | "_anchorPoint": { 767 | "__type__": "cc.Vec2", 768 | "x": 0.5, 769 | "y": 0.5 770 | }, 771 | "_contentSize": { 772 | "__type__": "cc.Size", 773 | "width": 205, 774 | "height": 41 775 | }, 776 | "_rotationX": 0, 777 | "_rotationY": 0, 778 | "_scaleX": 1, 779 | "_scaleY": 1, 780 | "_position": { 781 | "__type__": "cc.Vec2", 782 | "x": 1925, 783 | "y": 481 784 | }, 785 | "_skewX": 0, 786 | "_skewY": 0, 787 | "_localZOrder": 0, 788 | "_globalZOrder": 0, 789 | "_opacityModifyRGB": false, 790 | "groupIndex": 0 791 | }, 792 | { 793 | "__type__": "cc.Sprite", 794 | "_name": "", 795 | "_objFlags": 0, 796 | "node": { 797 | "__id__": 21 798 | }, 799 | "_enabled": true, 800 | "_spriteFrame": { 801 | "__uuid__": "f0e04b54-1ca5-4fc6-b651-346dd79a7c19" 802 | }, 803 | "_type": 2, 804 | "_sizeMode": 0, 805 | "_fillType": 0, 806 | "_fillCenter": { 807 | "__type__": "cc.Vec2", 808 | "x": 0, 809 | "y": 0 810 | }, 811 | "_fillStart": 0, 812 | "_fillRange": 0, 813 | "_isTrimmedMode": true, 814 | "_srcBlendFactor": 770, 815 | "_dstBlendFactor": 771, 816 | "_atlas": null 817 | }, 818 | { 819 | "__type__": "cc.RigidBody", 820 | "_name": "", 821 | "_objFlags": 0, 822 | "node": { 823 | "__id__": 21 824 | }, 825 | "_enabled": true, 826 | "_type": 0, 827 | "_allowSleep": true, 828 | "_gravityScale": 1, 829 | "_linearDamping": 0, 830 | "_angularDamping": 0, 831 | "_linearVelocity": { 832 | "__type__": "cc.Vec2", 833 | "x": 0, 834 | "y": 0 835 | }, 836 | "_angularVelocity": 0, 837 | "_fixedRotation": false, 838 | "enabledContactListener": false, 839 | "bullet": false 840 | }, 841 | { 842 | "__type__": "cc.PhysicsBoxCollider", 843 | "_name": "", 844 | "_objFlags": 0, 845 | "node": { 846 | "__id__": 21 847 | }, 848 | "_enabled": true, 849 | "tag": 0, 850 | "_density": 1, 851 | "_sensor": false, 852 | "_friction": 0.2, 853 | "_restitution": 0, 854 | "body": null, 855 | "_offset": { 856 | "__type__": "cc.Vec2", 857 | "x": 0, 858 | "y": 0 859 | }, 860 | "_size": { 861 | "__type__": "cc.Size", 862 | "width": 205, 863 | "height": 41 864 | } 865 | }, 866 | { 867 | "__type__": "cc.Node", 868 | "_name": "Box20", 869 | "_objFlags": 0, 870 | "_parent": { 871 | "__id__": 4 872 | }, 873 | "_children": [], 874 | "_tag": -1, 875 | "_active": true, 876 | "_components": [ 877 | { 878 | "__id__": 26 879 | }, 880 | { 881 | "__id__": 27 882 | }, 883 | { 884 | "__id__": 28 885 | } 886 | ], 887 | "_prefab": null, 888 | "_id": "25703ndi0JBCawmcaaFZ1oW", 889 | "_opacity": 255, 890 | "_color": { 891 | "__type__": "cc.Color", 892 | "r": 255, 893 | "g": 255, 894 | "b": 255, 895 | "a": 255 896 | }, 897 | "_cascadeOpacityEnabled": true, 898 | "_anchorPoint": { 899 | "__type__": "cc.Vec2", 900 | "x": 0, 901 | "y": 0 902 | }, 903 | "_contentSize": { 904 | "__type__": "cc.Size", 905 | "width": 2980, 906 | "height": 61.4 907 | }, 908 | "_rotationX": 0, 909 | "_rotationY": 0, 910 | "_scaleX": 1, 911 | "_scaleY": 1, 912 | "_position": { 913 | "__type__": "cc.Vec2", 914 | "x": -515, 915 | "y": -61 916 | }, 917 | "_skewX": 0, 918 | "_skewY": 0, 919 | "_localZOrder": 0, 920 | "_globalZOrder": 0, 921 | "_opacityModifyRGB": false, 922 | "groupIndex": 0 923 | }, 924 | { 925 | "__type__": "cc.Sprite", 926 | "_name": "", 927 | "_objFlags": 0, 928 | "node": { 929 | "__id__": 25 930 | }, 931 | "_enabled": true, 932 | "_spriteFrame": { 933 | "__uuid__": "0bcbdfa9-8ea8-4806-88e1-72e7c61dce1b" 934 | }, 935 | "_type": 1, 936 | "_sizeMode": 0, 937 | "_fillType": 0, 938 | "_fillCenter": { 939 | "__type__": "cc.Vec2", 940 | "x": 0, 941 | "y": 0 942 | }, 943 | "_fillStart": 0, 944 | "_fillRange": 0, 945 | "_isTrimmedMode": true, 946 | "_srcBlendFactor": 770, 947 | "_dstBlendFactor": 771, 948 | "_atlas": null 949 | }, 950 | { 951 | "__type__": "cc.RigidBody", 952 | "_name": "", 953 | "_objFlags": 0, 954 | "node": { 955 | "__id__": 25 956 | }, 957 | "_enabled": true, 958 | "_type": 0, 959 | "_allowSleep": true, 960 | "_gravityScale": 1, 961 | "_linearDamping": 0, 962 | "_angularDamping": 0, 963 | "_linearVelocity": { 964 | "__type__": "cc.Vec2", 965 | "x": 0, 966 | "y": 0 967 | }, 968 | "_angularVelocity": 0, 969 | "_fixedRotation": false, 970 | "enabledContactListener": false, 971 | "bullet": false 972 | }, 973 | { 974 | "__type__": "cc.PhysicsBoxCollider", 975 | "_name": "", 976 | "_objFlags": 0, 977 | "node": { 978 | "__id__": 25 979 | }, 980 | "_enabled": true, 981 | "tag": 0, 982 | "_density": 1, 983 | "_sensor": false, 984 | "_friction": 0.2, 985 | "_restitution": 0, 986 | "body": null, 987 | "_offset": { 988 | "__type__": "cc.Vec2", 989 | "x": 1490, 990 | "y": 30.7 991 | }, 992 | "_size": { 993 | "__type__": "cc.Size", 994 | "width": 2980, 995 | "height": 61.4 996 | } 997 | }, 998 | { 999 | "__type__": "cc.Node", 1000 | "_name": "gold", 1001 | "_objFlags": 0, 1002 | "_parent": { 1003 | "__id__": 4 1004 | }, 1005 | "_children": [], 1006 | "_tag": -1, 1007 | "_active": true, 1008 | "_components": [ 1009 | { 1010 | "__id__": 30 1011 | } 1012 | ], 1013 | "_prefab": null, 1014 | "_id": "70f63rXyk9NF4ZJAiJ2tn3t", 1015 | "_opacity": 255, 1016 | "_color": { 1017 | "__type__": "cc.Color", 1018 | "r": 255, 1019 | "g": 255, 1020 | "b": 255, 1021 | "a": 255 1022 | }, 1023 | "_cascadeOpacityEnabled": true, 1024 | "_anchorPoint": { 1025 | "__type__": "cc.Vec2", 1026 | "x": 0.5, 1027 | "y": 0.5 1028 | }, 1029 | "_contentSize": { 1030 | "__type__": "cc.Size", 1031 | "width": 60, 1032 | "height": 60 1033 | }, 1034 | "_rotationX": 0, 1035 | "_rotationY": 0, 1036 | "_scaleX": 1, 1037 | "_scaleY": 1, 1038 | "_position": { 1039 | "__type__": "cc.Vec2", 1040 | "x": 1929, 1041 | "y": 607 1042 | }, 1043 | "_skewX": 0, 1044 | "_skewY": 0, 1045 | "_localZOrder": 0, 1046 | "_globalZOrder": 0, 1047 | "_opacityModifyRGB": false, 1048 | "groupIndex": 0 1049 | }, 1050 | { 1051 | "__type__": "cc.Sprite", 1052 | "_name": "", 1053 | "_objFlags": 0, 1054 | "node": { 1055 | "__id__": 29 1056 | }, 1057 | "_enabled": true, 1058 | "_spriteFrame": { 1059 | "__uuid__": "a717766a-81bb-4c67-b417-6aee005b5254" 1060 | }, 1061 | "_type": 0, 1062 | "_sizeMode": 0, 1063 | "_fillType": 0, 1064 | "_fillCenter": { 1065 | "__type__": "cc.Vec2", 1066 | "x": 0, 1067 | "y": 0 1068 | }, 1069 | "_fillStart": 0, 1070 | "_fillRange": 0, 1071 | "_isTrimmedMode": true, 1072 | "_srcBlendFactor": 770, 1073 | "_dstBlendFactor": 771, 1074 | "_atlas": null 1075 | }, 1076 | { 1077 | "__type__": "cc.Node", 1078 | "_name": "gold", 1079 | "_objFlags": 0, 1080 | "_parent": { 1081 | "__id__": 4 1082 | }, 1083 | "_children": [], 1084 | "_tag": -1, 1085 | "_active": true, 1086 | "_components": [ 1087 | { 1088 | "__id__": 32 1089 | }, 1090 | { 1091 | "__id__": 33 1092 | }, 1093 | { 1094 | "__id__": 34 1095 | } 1096 | ], 1097 | "_prefab": null, 1098 | "_id": "a0862L0muVOwphLmlmhSrTX", 1099 | "_opacity": 255, 1100 | "_color": { 1101 | "__type__": "cc.Color", 1102 | "r": 255, 1103 | "g": 255, 1104 | "b": 255, 1105 | "a": 255 1106 | }, 1107 | "_cascadeOpacityEnabled": true, 1108 | "_anchorPoint": { 1109 | "__type__": "cc.Vec2", 1110 | "x": 0.5, 1111 | "y": 0.5 1112 | }, 1113 | "_contentSize": { 1114 | "__type__": "cc.Size", 1115 | "width": 60, 1116 | "height": 60 1117 | }, 1118 | "_rotationX": 0, 1119 | "_rotationY": 0, 1120 | "_scaleX": 1, 1121 | "_scaleY": 1, 1122 | "_position": { 1123 | "__type__": "cc.Vec2", 1124 | "x": 397, 1125 | "y": 301 1126 | }, 1127 | "_skewX": 0, 1128 | "_skewY": 0, 1129 | "_localZOrder": 0, 1130 | "_globalZOrder": 0, 1131 | "_opacityModifyRGB": false, 1132 | "groupIndex": 0 1133 | }, 1134 | { 1135 | "__type__": "cc.Sprite", 1136 | "_name": "", 1137 | "_objFlags": 0, 1138 | "node": { 1139 | "__id__": 31 1140 | }, 1141 | "_enabled": true, 1142 | "_spriteFrame": { 1143 | "__uuid__": "a717766a-81bb-4c67-b417-6aee005b5254" 1144 | }, 1145 | "_type": 0, 1146 | "_sizeMode": 0, 1147 | "_fillType": 0, 1148 | "_fillCenter": { 1149 | "__type__": "cc.Vec2", 1150 | "x": 0, 1151 | "y": 0 1152 | }, 1153 | "_fillStart": 0, 1154 | "_fillRange": 0, 1155 | "_isTrimmedMode": true, 1156 | "_srcBlendFactor": 770, 1157 | "_dstBlendFactor": 771, 1158 | "_atlas": null 1159 | }, 1160 | { 1161 | "__type__": "cc.RigidBody", 1162 | "_name": "", 1163 | "_objFlags": 0, 1164 | "node": { 1165 | "__id__": 31 1166 | }, 1167 | "_enabled": true, 1168 | "_type": 0, 1169 | "_allowSleep": true, 1170 | "_gravityScale": 1, 1171 | "_linearDamping": 0, 1172 | "_angularDamping": 0, 1173 | "_linearVelocity": { 1174 | "__type__": "cc.Vec2", 1175 | "x": 0, 1176 | "y": 0 1177 | }, 1178 | "_angularVelocity": 0, 1179 | "_fixedRotation": false, 1180 | "enabledContactListener": false, 1181 | "bullet": false 1182 | }, 1183 | { 1184 | "__type__": "cc.PhysicsCircleCollider", 1185 | "_name": "", 1186 | "_objFlags": 0, 1187 | "node": { 1188 | "__id__": 31 1189 | }, 1190 | "_enabled": true, 1191 | "tag": 100, 1192 | "_density": 1, 1193 | "_sensor": true, 1194 | "_friction": 0.2, 1195 | "_restitution": 0, 1196 | "body": null, 1197 | "_offset": { 1198 | "__type__": "cc.Vec2", 1199 | "x": 0, 1200 | "y": 0 1201 | }, 1202 | "_radius": 30 1203 | }, 1204 | { 1205 | "__type__": "cc.Node", 1206 | "_name": "Box20", 1207 | "_objFlags": 0, 1208 | "_parent": { 1209 | "__id__": 4 1210 | }, 1211 | "_children": [], 1212 | "_tag": -1, 1213 | "_active": true, 1214 | "_components": [ 1215 | { 1216 | "__id__": 36 1217 | }, 1218 | { 1219 | "__id__": 37 1220 | }, 1221 | { 1222 | "__id__": 38 1223 | } 1224 | ], 1225 | "_prefab": null, 1226 | "_id": "18420176XNKOLTQ2CXoNWzi", 1227 | "_opacity": 255, 1228 | "_color": { 1229 | "__type__": "cc.Color", 1230 | "r": 255, 1231 | "g": 255, 1232 | "b": 255, 1233 | "a": 255 1234 | }, 1235 | "_cascadeOpacityEnabled": true, 1236 | "_anchorPoint": { 1237 | "__type__": "cc.Vec2", 1238 | "x": 0, 1239 | "y": 0 1240 | }, 1241 | "_contentSize": { 1242 | "__type__": "cc.Size", 1243 | "width": 319, 1244 | "height": 915 1245 | }, 1246 | "_rotationX": 0, 1247 | "_rotationY": 0, 1248 | "_scaleX": 1, 1249 | "_scaleY": 1, 1250 | "_position": { 1251 | "__type__": "cc.Vec2", 1252 | "x": -817, 1253 | "y": -64 1254 | }, 1255 | "_skewX": 0, 1256 | "_skewY": 0, 1257 | "_localZOrder": 0, 1258 | "_globalZOrder": 0, 1259 | "_opacityModifyRGB": false, 1260 | "groupIndex": 0 1261 | }, 1262 | { 1263 | "__type__": "cc.Sprite", 1264 | "_name": "", 1265 | "_objFlags": 0, 1266 | "node": { 1267 | "__id__": 35 1268 | }, 1269 | "_enabled": true, 1270 | "_spriteFrame": { 1271 | "__uuid__": "0bcbdfa9-8ea8-4806-88e1-72e7c61dce1b" 1272 | }, 1273 | "_type": 1, 1274 | "_sizeMode": 0, 1275 | "_fillType": 0, 1276 | "_fillCenter": { 1277 | "__type__": "cc.Vec2", 1278 | "x": 0, 1279 | "y": 0 1280 | }, 1281 | "_fillStart": 0, 1282 | "_fillRange": 0, 1283 | "_isTrimmedMode": true, 1284 | "_srcBlendFactor": 770, 1285 | "_dstBlendFactor": 771, 1286 | "_atlas": null 1287 | }, 1288 | { 1289 | "__type__": "cc.RigidBody", 1290 | "_name": "", 1291 | "_objFlags": 0, 1292 | "node": { 1293 | "__id__": 35 1294 | }, 1295 | "_enabled": true, 1296 | "_type": 0, 1297 | "_allowSleep": true, 1298 | "_gravityScale": 1, 1299 | "_linearDamping": 0, 1300 | "_angularDamping": 0, 1301 | "_linearVelocity": { 1302 | "__type__": "cc.Vec2", 1303 | "x": 0, 1304 | "y": 0 1305 | }, 1306 | "_angularVelocity": 0, 1307 | "_fixedRotation": false, 1308 | "enabledContactListener": false, 1309 | "bullet": false 1310 | }, 1311 | { 1312 | "__type__": "cc.PhysicsBoxCollider", 1313 | "_name": "", 1314 | "_objFlags": 0, 1315 | "node": { 1316 | "__id__": 35 1317 | }, 1318 | "_enabled": true, 1319 | "tag": 0, 1320 | "_density": 1, 1321 | "_sensor": false, 1322 | "_friction": 0.2, 1323 | "_restitution": 0, 1324 | "body": null, 1325 | "_offset": { 1326 | "__type__": "cc.Vec2", 1327 | "x": 159.5, 1328 | "y": 457.5 1329 | }, 1330 | "_size": { 1331 | "__type__": "cc.Size", 1332 | "width": 319, 1333 | "height": 915 1334 | } 1335 | }, 1336 | { 1337 | "__type__": "cc.Node", 1338 | "_name": "Box20", 1339 | "_objFlags": 0, 1340 | "_parent": { 1341 | "__id__": 4 1342 | }, 1343 | "_children": [], 1344 | "_tag": -1, 1345 | "_active": true, 1346 | "_components": [ 1347 | { 1348 | "__id__": 40 1349 | }, 1350 | { 1351 | "__id__": 41 1352 | }, 1353 | { 1354 | "__id__": 42 1355 | } 1356 | ], 1357 | "_prefab": null, 1358 | "_id": "16bd2xyXD1BE5SBfpO1Oe2R", 1359 | "_opacity": 255, 1360 | "_color": { 1361 | "__type__": "cc.Color", 1362 | "r": 255, 1363 | "g": 255, 1364 | "b": 255, 1365 | "a": 255 1366 | }, 1367 | "_cascadeOpacityEnabled": true, 1368 | "_anchorPoint": { 1369 | "__type__": "cc.Vec2", 1370 | "x": 0, 1371 | "y": 0 1372 | }, 1373 | "_contentSize": { 1374 | "__type__": "cc.Size", 1375 | "width": 319, 1376 | "height": 919 1377 | }, 1378 | "_rotationX": 0, 1379 | "_rotationY": 0, 1380 | "_scaleX": 1, 1381 | "_scaleY": 1, 1382 | "_position": { 1383 | "__type__": "cc.Vec2", 1384 | "x": 2463, 1385 | "y": -64 1386 | }, 1387 | "_skewX": 0, 1388 | "_skewY": 0, 1389 | "_localZOrder": 0, 1390 | "_globalZOrder": 0, 1391 | "_opacityModifyRGB": false, 1392 | "groupIndex": 0 1393 | }, 1394 | { 1395 | "__type__": "cc.Sprite", 1396 | "_name": "", 1397 | "_objFlags": 0, 1398 | "node": { 1399 | "__id__": 39 1400 | }, 1401 | "_enabled": true, 1402 | "_spriteFrame": { 1403 | "__uuid__": "0bcbdfa9-8ea8-4806-88e1-72e7c61dce1b" 1404 | }, 1405 | "_type": 1, 1406 | "_sizeMode": 0, 1407 | "_fillType": 0, 1408 | "_fillCenter": { 1409 | "__type__": "cc.Vec2", 1410 | "x": 0, 1411 | "y": 0 1412 | }, 1413 | "_fillStart": 0, 1414 | "_fillRange": 0, 1415 | "_isTrimmedMode": true, 1416 | "_srcBlendFactor": 770, 1417 | "_dstBlendFactor": 771, 1418 | "_atlas": null 1419 | }, 1420 | { 1421 | "__type__": "cc.RigidBody", 1422 | "_name": "", 1423 | "_objFlags": 0, 1424 | "node": { 1425 | "__id__": 39 1426 | }, 1427 | "_enabled": true, 1428 | "_type": 0, 1429 | "_allowSleep": true, 1430 | "_gravityScale": 1, 1431 | "_linearDamping": 0, 1432 | "_angularDamping": 0, 1433 | "_linearVelocity": { 1434 | "__type__": "cc.Vec2", 1435 | "x": 0, 1436 | "y": 0 1437 | }, 1438 | "_angularVelocity": 0, 1439 | "_fixedRotation": false, 1440 | "enabledContactListener": false, 1441 | "bullet": false 1442 | }, 1443 | { 1444 | "__type__": "cc.PhysicsBoxCollider", 1445 | "_name": "", 1446 | "_objFlags": 0, 1447 | "node": { 1448 | "__id__": 39 1449 | }, 1450 | "_enabled": true, 1451 | "tag": 0, 1452 | "_density": 1, 1453 | "_sensor": false, 1454 | "_friction": 0.2, 1455 | "_restitution": 0, 1456 | "body": null, 1457 | "_offset": { 1458 | "__type__": "cc.Vec2", 1459 | "x": 159.5, 1460 | "y": 457.5 1461 | }, 1462 | "_size": { 1463 | "__type__": "cc.Size", 1464 | "width": 319, 1465 | "height": 919 1466 | } 1467 | }, 1468 | { 1469 | "__type__": "cc.Node", 1470 | "_name": "Hero", 1471 | "_objFlags": 0, 1472 | "_parent": { 1473 | "__id__": 1 1474 | }, 1475 | "_children": [], 1476 | "_tag": -1, 1477 | "_active": true, 1478 | "_components": [ 1479 | { 1480 | "__id__": 44 1481 | }, 1482 | { 1483 | "__id__": 45 1484 | }, 1485 | { 1486 | "__id__": 51 1487 | }, 1488 | { 1489 | "__id__": 52 1490 | } 1491 | ], 1492 | "_prefab": null, 1493 | "_id": "e5e84/jcxZNmJaEKpDioirG", 1494 | "_opacity": 255, 1495 | "_color": { 1496 | "__type__": "cc.Color", 1497 | "r": 255, 1498 | "g": 255, 1499 | "b": 255, 1500 | "a": 255 1501 | }, 1502 | "_cascadeOpacityEnabled": true, 1503 | "_anchorPoint": { 1504 | "__type__": "cc.Vec2", 1505 | "x": 0.5, 1506 | "y": 0 1507 | }, 1508 | "_contentSize": { 1509 | "__type__": "cc.Size", 1510 | "width": 80, 1511 | "height": 100 1512 | }, 1513 | "_rotationX": 0, 1514 | "_rotationY": 0, 1515 | "_scaleX": 1, 1516 | "_scaleY": 1, 1517 | "_position": { 1518 | "__type__": "cc.Vec2", 1519 | "x": -334, 1520 | "y": 0 1521 | }, 1522 | "_skewX": 0, 1523 | "_skewY": 0, 1524 | "_localZOrder": 0, 1525 | "_globalZOrder": 0, 1526 | "_opacityModifyRGB": false, 1527 | "groupIndex": 0 1528 | }, 1529 | { 1530 | "__type__": "cc.Sprite", 1531 | "_name": "", 1532 | "_objFlags": 0, 1533 | "node": { 1534 | "__id__": 43 1535 | }, 1536 | "_enabled": true, 1537 | "_spriteFrame": { 1538 | "__uuid__": "2d32b737-c9bc-446a-b542-8eed6ad0be2f" 1539 | }, 1540 | "_type": 0, 1541 | "_sizeMode": 0, 1542 | "_fillType": 0, 1543 | "_fillCenter": { 1544 | "__type__": "cc.Vec2", 1545 | "x": 0, 1546 | "y": 0 1547 | }, 1548 | "_fillStart": 0, 1549 | "_fillRange": 0, 1550 | "_isTrimmedMode": true, 1551 | "_srcBlendFactor": 770, 1552 | "_dstBlendFactor": 771, 1553 | "_atlas": null 1554 | }, 1555 | { 1556 | "__type__": "6fc86RgnPlPjLOL8x/OVTmI", 1557 | "_name": "", 1558 | "_objFlags": 0, 1559 | "node": { 1560 | "__id__": 43 1561 | }, 1562 | "_enabled": true, 1563 | "camera": { 1564 | "__id__": 46 1565 | }, 1566 | "maxSpeed": 500, 1567 | "jumps": 2, 1568 | "acceleration": 1800, 1569 | "jumpSpeed": 1200, 1570 | "drag": 600 1571 | }, 1572 | { 1573 | "__type__": "d1e93YcLzhOiohXX6bHj9ay", 1574 | "_name": "", 1575 | "_objFlags": 0, 1576 | "node": { 1577 | "__id__": 47 1578 | }, 1579 | "_enabled": true, 1580 | "target": { 1581 | "__id__": 43 1582 | }, 1583 | "camera": { 1584 | "__id__": 49 1585 | }, 1586 | "anim": { 1587 | "__id__": 50 1588 | }, 1589 | "jumpZoom": false, 1590 | "centerAtStart": true, 1591 | "smoothFollow": false, 1592 | "followX": 350, 1593 | "followY": 120, 1594 | "minFollowDist": 30, 1595 | "followRatio": 0.05, 1596 | "overview": false, 1597 | "overviewTargets": [ 1598 | { 1599 | "__id__": 43 1600 | }, 1601 | { 1602 | "__id__": 29 1603 | }, 1604 | { 1605 | "__id__": 31 1606 | } 1607 | ], 1608 | "overviewMargin": 80, 1609 | "speedZoom": false, 1610 | "zoomInSpeed": 800, 1611 | "zoomOutSpeed": 300, 1612 | "canShake": false, 1613 | "shakeDuration": 0.5, 1614 | "pointerPan": false, 1615 | "pointerXMult": 300, 1616 | "pointerYMult": 200, 1617 | "useBoundaries": false, 1618 | "topBound": 1000, 1619 | "bottomBound": -150, 1620 | "leftBound": -800, 1621 | "rightBound": 2500 1622 | }, 1623 | { 1624 | "__type__": "cc.Node", 1625 | "_name": "CameraContainer", 1626 | "_objFlags": 0, 1627 | "_parent": { 1628 | "__id__": 1 1629 | }, 1630 | "_children": [ 1631 | { 1632 | "__id__": 48 1633 | } 1634 | ], 1635 | "_tag": -1, 1636 | "_active": true, 1637 | "_components": [ 1638 | { 1639 | "__id__": 46 1640 | } 1641 | ], 1642 | "_prefab": null, 1643 | "_id": "e34e9DAdAdHX4xpjXKguBoL", 1644 | "_opacity": 255, 1645 | "_color": { 1646 | "__type__": "cc.Color", 1647 | "r": 255, 1648 | "g": 255, 1649 | "b": 255, 1650 | "a": 255 1651 | }, 1652 | "_cascadeOpacityEnabled": true, 1653 | "_anchorPoint": { 1654 | "__type__": "cc.Vec2", 1655 | "x": 0.5, 1656 | "y": 0.5 1657 | }, 1658 | "_contentSize": { 1659 | "__type__": "cc.Size", 1660 | "width": 0, 1661 | "height": 0 1662 | }, 1663 | "_rotationX": 0, 1664 | "_rotationY": 0, 1665 | "_scaleX": 1, 1666 | "_scaleY": 1, 1667 | "_position": { 1668 | "__type__": "cc.Vec2", 1669 | "x": 0, 1670 | "y": 0 1671 | }, 1672 | "_skewX": 0, 1673 | "_skewY": 0, 1674 | "_localZOrder": 0, 1675 | "_globalZOrder": 0, 1676 | "_opacityModifyRGB": false, 1677 | "groupIndex": 0 1678 | }, 1679 | { 1680 | "__type__": "cc.Node", 1681 | "_name": "Camera", 1682 | "_objFlags": 0, 1683 | "_parent": { 1684 | "__id__": 47 1685 | }, 1686 | "_children": [], 1687 | "_tag": -1, 1688 | "_active": true, 1689 | "_components": [ 1690 | { 1691 | "__id__": 49 1692 | }, 1693 | { 1694 | "__id__": 50 1695 | } 1696 | ], 1697 | "_prefab": null, 1698 | "_id": "c030fYMUstE7ZH3jrOkxXCq", 1699 | "_opacity": 255, 1700 | "_color": { 1701 | "__type__": "cc.Color", 1702 | "r": 255, 1703 | "g": 255, 1704 | "b": 255, 1705 | "a": 255 1706 | }, 1707 | "_cascadeOpacityEnabled": true, 1708 | "_anchorPoint": { 1709 | "__type__": "cc.Vec2", 1710 | "x": 0.5, 1711 | "y": 0.5 1712 | }, 1713 | "_contentSize": { 1714 | "__type__": "cc.Size", 1715 | "width": 0, 1716 | "height": 0 1717 | }, 1718 | "_rotationX": 0, 1719 | "_rotationY": 0, 1720 | "_scaleX": 1, 1721 | "_scaleY": 1, 1722 | "_position": { 1723 | "__type__": "cc.Vec2", 1724 | "x": 0, 1725 | "y": 0 1726 | }, 1727 | "_skewX": 0, 1728 | "_skewY": 0, 1729 | "_localZOrder": 0, 1730 | "_globalZOrder": 0, 1731 | "_opacityModifyRGB": false, 1732 | "groupIndex": 0 1733 | }, 1734 | { 1735 | "__type__": "cc.Camera", 1736 | "_name": "", 1737 | "_objFlags": 0, 1738 | "node": { 1739 | "__id__": 48 1740 | }, 1741 | "_enabled": true, 1742 | "_targets": [ 1743 | { 1744 | "__id__": 43 1745 | }, 1746 | { 1747 | "__id__": 4 1748 | } 1749 | ], 1750 | "zoomRatio": 1 1751 | }, 1752 | { 1753 | "__type__": "cc.Animation", 1754 | "_name": "", 1755 | "_objFlags": 0, 1756 | "node": { 1757 | "__id__": 48 1758 | }, 1759 | "_enabled": true, 1760 | "_defaultClip": null, 1761 | "_clips": [ 1762 | { 1763 | "__uuid__": "b33569d1-efb9-4dfd-b4ac-a095f5a93f0d" 1764 | } 1765 | ], 1766 | "playOnLoad": false 1767 | }, 1768 | { 1769 | "__type__": "cc.RigidBody", 1770 | "_name": "", 1771 | "_objFlags": 0, 1772 | "node": { 1773 | "__id__": 43 1774 | }, 1775 | "_enabled": true, 1776 | "_type": 2, 1777 | "_allowSleep": true, 1778 | "_gravityScale": 9, 1779 | "_linearDamping": 0, 1780 | "_angularDamping": 0, 1781 | "_linearVelocity": { 1782 | "__type__": "cc.Vec2", 1783 | "x": 0, 1784 | "y": 0 1785 | }, 1786 | "_angularVelocity": 0, 1787 | "_fixedRotation": true, 1788 | "enabledContactListener": true, 1789 | "bullet": false 1790 | }, 1791 | { 1792 | "__type__": "cc.PhysicsBoxCollider", 1793 | "_name": "", 1794 | "_objFlags": 0, 1795 | "node": { 1796 | "__id__": 43 1797 | }, 1798 | "_enabled": true, 1799 | "tag": 0, 1800 | "_density": 1, 1801 | "_sensor": false, 1802 | "_friction": 0, 1803 | "_restitution": 0, 1804 | "body": null, 1805 | "_offset": { 1806 | "__type__": "cc.Vec2", 1807 | "x": 0, 1808 | "y": 50 1809 | }, 1810 | "_size": { 1811 | "__type__": "cc.Size", 1812 | "width": 80, 1813 | "height": 100 1814 | } 1815 | } 1816 | ] -------------------------------------------------------------------------------- /assets/camera.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "531985b9-a63c-4d5b-abaa-b72e6aea1740", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/res.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "d271a67f-e9ec-41d1-b8eb-e8b4f1be7422", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/res/texture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "6865f575-0aff-4aae-a32f-0e555afb4544", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/res/texture/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/1.png -------------------------------------------------------------------------------- /assets/res/texture/1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "4c01a09b-d18b-4ab9-96ac-78c2751f069d", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "1": { 9 | "ver": "1.0.3", 10 | "uuid": "2d32b737-c9bc-446a-b542-8eed6ad0be2f", 11 | "rawTextureUuid": "4c01a09b-d18b-4ab9-96ac-78c2751f069d", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -2, 16 | "offsetY": 0, 17 | "trimX": 1, 18 | "trimY": 0, 19 | "width": 232, 20 | "height": 281, 21 | "rawWidth": 238, 22 | "rawHeight": 281, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Arc90_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Arc90_40.png -------------------------------------------------------------------------------- /assets/res/texture/Arc90_40.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "a9a3fd07-62ae-475d-b765-0bf1e109b41d", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Arc90_40": { 9 | "ver": "1.0.3", 10 | "uuid": "67802b9a-feb0-44ec-adb3-9213a2e80d49", 11 | "rawTextureUuid": "a9a3fd07-62ae-475d-b765-0bf1e109b41d", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 41, 20 | "height": 41, 21 | "rawWidth": 41, 22 | "rawHeight": 41, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/ArcEgg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/ArcEgg.png -------------------------------------------------------------------------------- /assets/res/texture/ArcEgg.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "fc0aaed5-9870-4779-ba3b-705c83768f46", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "ArcEgg": { 9 | "ver": "1.0.3", 10 | "uuid": "5b353d60-5631-4dd7-8b1e-373a1222b59f", 11 | "rawTextureUuid": "fc0aaed5-9870-4779-ba3b-705c83768f46", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 82, 20 | "height": 118, 21 | "rawWidth": 82, 22 | "rawHeight": 118, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Box20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Box20.png -------------------------------------------------------------------------------- /assets/res/texture/Box20.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "07c7364a-b85a-44b8-a467-7e0c9668f9ca", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Box20": { 9 | "ver": "1.0.3", 10 | "uuid": "0bcbdfa9-8ea8-4806-88e1-72e7c61dce1b", 11 | "rawTextureUuid": "07c7364a-b85a-44b8-a467-7e0c9668f9ca", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 21, 20 | "height": 21, 21 | "rawWidth": 21, 22 | "rawHeight": 21, 23 | "borderTop": 2, 24 | "borderBottom": 2, 25 | "borderLeft": 2, 26 | "borderRight": 2, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Box40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Box40.png -------------------------------------------------------------------------------- /assets/res/texture/Box40.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "ece2d54f-f339-4eca-970a-9f2ef6aaa2ae", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Box40": { 9 | "ver": "1.0.3", 10 | "uuid": "f0e04b54-1ca5-4fc6-b651-346dd79a7c19", 11 | "rawTextureUuid": "ece2d54f-f339-4eca-970a-9f2ef6aaa2ae", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 41, 20 | "height": 41, 21 | "rawWidth": 41, 22 | "rawHeight": 41, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Box80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Box80.png -------------------------------------------------------------------------------- /assets/res/texture/Box80.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "bf25b911-e07e-45d4-9ee4-289a60565774", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Box80": { 9 | "ver": "1.0.3", 10 | "uuid": "cddb2c64-a433-45b3-bdc4-0b27333e086a", 11 | "rawTextureUuid": "bf25b911-e07e-45d4-9ee4-289a60565774", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 81, 20 | "height": 81, 21 | "rawWidth": 81, 22 | "rawHeight": 81, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Circle20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Circle20.png -------------------------------------------------------------------------------- /assets/res/texture/Circle20.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "f4db64d7-ea42-4d6b-aefd-75e03dc9cfe2", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Circle20": { 9 | "ver": "1.0.3", 10 | "uuid": "ac7945fb-e042-403f-be91-00183cda1f4b", 11 | "rawTextureUuid": "f4db64d7-ea42-4d6b-aefd-75e03dc9cfe2", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 21, 20 | "height": 21, 21 | "rawWidth": 21, 22 | "rawHeight": 21, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Circle40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Circle40.png -------------------------------------------------------------------------------- /assets/res/texture/Circle40.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "03695f35-668b-49ca-b620-de10061ee45a", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Circle40": { 9 | "ver": "1.0.3", 10 | "uuid": "9cfa3853-1095-4989-81b9-89f8cf45594f", 11 | "rawTextureUuid": "03695f35-668b-49ca-b620-de10061ee45a", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 41, 20 | "height": 41, 21 | "rawWidth": 41, 22 | "rawHeight": 41, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Circle80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Circle80.png -------------------------------------------------------------------------------- /assets/res/texture/Circle80.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "96516923-59fb-4476-aafd-c18c1aa824ee", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Circle80": { 9 | "ver": "1.0.3", 10 | "uuid": "7ddaf948-2c3e-4867-aebd-a2ad23fc7cda", 11 | "rawTextureUuid": "96516923-59fb-4476-aafd-c18c1aa824ee", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 81, 20 | "height": 81, 21 | "rawWidth": 81, 22 | "rawHeight": 81, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/LineArc90_40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/LineArc90_40.png -------------------------------------------------------------------------------- /assets/res/texture/LineArc90_40.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "73c13048-c106-43a4-9351-f70adfb0e96b", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "LineArc90_40": { 9 | "ver": "1.0.3", 10 | "uuid": "24192983-0e5a-46bb-87ca-60c6bcc4dd26", 11 | "rawTextureUuid": "73c13048-c106-43a4-9351-f70adfb0e96b", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 41, 20 | "height": 41, 21 | "rawWidth": 41, 22 | "rawHeight": 41, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Platform160.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Platform160.png -------------------------------------------------------------------------------- /assets/res/texture/Platform160.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "2be04d91-f11a-4380-9d19-f044e72792fa", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Platform160": { 9 | "ver": "1.0.3", 10 | "uuid": "a04566e6-5563-466e-bff2-3137ac3566c6", 11 | "rawTextureUuid": "2be04d91-f11a-4380-9d19-f044e72792fa", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 161, 20 | "height": 11, 21 | "rawWidth": 161, 22 | "rawHeight": 11, 23 | "borderTop": 4, 24 | "borderBottom": 2, 25 | "borderLeft": 2, 26 | "borderRight": 2, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Triangle20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Triangle20.png -------------------------------------------------------------------------------- /assets/res/texture/Triangle20.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "b1df25be-0c8f-4014-b239-9178cc7d8b40", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Triangle20": { 9 | "ver": "1.0.3", 10 | "uuid": "f4db590f-8c4e-40d4-9a61-542391c0844c", 11 | "rawTextureUuid": "b1df25be-0c8f-4014-b239-9178cc7d8b40", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 20, 20 | "height": 20, 21 | "rawWidth": 20, 22 | "rawHeight": 20, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/Triangle40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/Triangle40.png -------------------------------------------------------------------------------- /assets/res/texture/Triangle40.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "918eab94-e349-4954-9f92-25cd383008a9", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "Triangle40": { 9 | "ver": "1.0.3", 10 | "uuid": "d426d7bc-4512-467b-ae5c-c5b57629e6ed", 11 | "rawTextureUuid": "918eab94-e349-4954-9f92-25cd383008a9", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 40, 20 | "height": 40, 21 | "rawWidth": 40, 22 | "rawHeight": 40, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/gold.png -------------------------------------------------------------------------------- /assets/res/texture/gold.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "99ce2773-c288-4d67-9868-27bb8d5e9ea9", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "gold": { 9 | "ver": "1.0.3", 10 | "uuid": "a717766a-81bb-4c67-b417-6aee005b5254", 11 | "rawTextureUuid": "99ce2773-c288-4d67-9868-27bb8d5e9ea9", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 80, 20 | "height": 80, 21 | "rawWidth": 80, 22 | "rawHeight": 80, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/goldcoin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/goldcoin.png -------------------------------------------------------------------------------- /assets/res/texture/goldcoin.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "6ee311af-2e56-480a-98dd-ee63e3d5b24c", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "goldcoin": { 9 | "ver": "1.0.3", 10 | "uuid": "e304a643-7e04-4e85-a821-d14986bb562c", 11 | "rawTextureUuid": "6ee311af-2e56-480a-98dd-ee63e3d5b24c", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 80, 20 | "height": 80, 21 | "rawWidth": 80, 22 | "rawHeight": 80, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/spr_f_ayla.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/spr_f_ayla.png -------------------------------------------------------------------------------- /assets/res/texture/spr_f_ayla.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "a708c796-c7c7-4145-84ab-12e7cee50af5", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "spr_f_ayla": { 9 | "ver": "1.0.3", 10 | "uuid": "bb72c943-2272-45db-9846-523810c77d52", 11 | "rawTextureUuid": "a708c796-c7c7-4145-84ab-12e7cee50af5", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -1, 16 | "offsetY": -9, 17 | "trimX": 3, 18 | "trimY": 18, 19 | "width": 56, 20 | "height": 62, 21 | "rawWidth": 64, 22 | "rawHeight": 80, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/texture/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cocos-creator/example-camera-deprecated/a652f9d5b0e181cc108672905de0409c657c7b01/assets/res/texture/star.png -------------------------------------------------------------------------------- /assets/res/texture/star.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "b11c4d7c-b15b-4eb6-883b-1697c1388e21", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "star": { 9 | "ver": "1.0.3", 10 | "uuid": "28275995-c6bb-4db7-8c7a-8cfc1853abfe", 11 | "rawTextureUuid": "b11c4d7c-b15b-4eb6-883b-1697c1388e21", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": -4, 17 | "trimX": 0, 18 | "trimY": 12, 19 | "width": 169, 20 | "height": 185, 21 | "rawWidth": 169, 22 | "rawHeight": 201, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/res/tiled.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "564622ee-3618-4b23-ba6a-e580c0c5a5a2", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/res/tiled/map.tmx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | eJzt0cENQEAQhtFJlsJRGSpBI5QwF3Yi7yX/bQ+T/SIAAAAAAAAA3re2iC25vfW+9v+O54/P5C49XjeNEUty89j72v/ToxY9atGjFj1q0eNb15B7p0ctegAZN2p/Raw= 9 | 10 | 11 | 12 | 13 | eJzt1ckNglAUheHLY1hpEQ6NaDtqEehS7cShBnWrRTgstQevAtEIkkc0DuH/khMWD4FwuD4RAAAAAAAAAAAAAADwqxxPxGhc79tPgoua9lDXNOjj47JmoRVEx3bwnWcqM2bBTseIdDU9k15buCLLOCv3tfswC3aG2sNIM87oY6sd7OLsLfrY67d/8G4dvqvLMpk4IjPN1Emvhb7IIE7ff36NpAdXz/H8W4dFukRkrT3MNZuCfST7s7nroXF3/uDht48zY5MyztUxno9TwT6S/fm6R+ta80kXl4RBemZsUsa5qpioj2rG/pHXR5jz/t+VvP/If3YG2PRU8g== 14 | 15 | 16 | 17 | 18 | eJzt00EKgCAQBVDtAN3/VHWT6AgFIYioq4YI3oOPi5nVfEwJAAAAAAAAAAAA/m/L48z2iHHkcc4q7YwY+33bdXneNu3eaMZ7yn1LJ3U3vT19xOr9C3185wJ/LS6O 19 | 20 | 21 | 22 | 23 | eJzt0dsRgkAQRNHd/KMQkDzkYR4oEgedxVJyTtX9n+opBQAAAAAAAAAA+CePWkqX+jSkZxpr66vu65XtpzSnJa3p7R/NbNn+k75pT790+AcAXMYJ6RIN0g== 24 | 25 | 26 | 27 | 28 | eJzt1ssNgmAQReGBzlAg8dGEgCY+mlDsRHdiJWIlWoTXrQtj9DeTwPmSs2FBbpgNZgAAAAAAAAAAAPiHJDIbqGHkvQRPM92hUKVKVcZdXG31/XeqVpWacw/grZu6e48AHNVq7z2iIyZq+uM7DuoYYAvM1mrjPQJfyQP9v55is0ad4zDv64ORGr88WwS6x0V3aNWVe3xsqVbeIwB0zgN4thDt 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /assets/res/tiled/map.tmx.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.4", 3 | "uuid": "4ebbb0ed-7b2d-4d39-9659-f7ca828a953f", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/script.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "e9f429fe-4d5e-4ccc-ad9b-3060e293c36c", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/script/CameraControl.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | target: { 6 | default: null, 7 | type: cc.Node 8 | }, 9 | camera: cc.Camera, 10 | anim: cc.Animation, 11 | //Jump Zoom 12 | jumpZoom: false, 13 | centerAtStart: false, 14 | //Smooth Follow 15 | smoothFollow: false, 16 | followX: { 17 | default: 0, 18 | visible () { 19 | return this.smoothFollow; 20 | } 21 | }, 22 | followY: { 23 | default: 0, 24 | visible () { 25 | return this.smoothFollow; 26 | } 27 | }, 28 | minFollowDist: { 29 | default: 0, 30 | visible () { 31 | return this.smoothFollow; 32 | } 33 | }, 34 | followRatio:{ 35 | default: 0, 36 | visible () { 37 | return this.smoothFollow; 38 | } 39 | }, 40 | //Overview 41 | overview: false, 42 | overviewTargets: { 43 | default: [], 44 | type: [cc.Node], 45 | visible () { 46 | return this.overview; 47 | } 48 | }, 49 | overviewMargin: { 50 | default: 0, 51 | visible () { 52 | return this.overview; 53 | } 54 | }, 55 | //Speed Zoom 56 | speedZoom: false, 57 | zoomInSpeed: { 58 | default: 0, 59 | visible () { 60 | return this.speedZoom; 61 | } 62 | }, 63 | zoomOutSpeed: { 64 | default: 0, 65 | visible () { 66 | return this.speedZoom; 67 | } 68 | }, 69 | //Camera Shake 70 | canShake: false, 71 | shakeDuration: { 72 | default: 0, 73 | visible () { 74 | return this.canShake; 75 | } 76 | }, 77 | //Pointer Pan 78 | pointerPan: false, 79 | pointerXMult: { 80 | default: 0, 81 | visible () { 82 | return this.pointerPan; 83 | } 84 | }, 85 | pointerYMult: { 86 | default: 0, 87 | visible () { 88 | return this.pointerPan; 89 | } 90 | }, 91 | //Boundaries in world position 92 | useBoundaries: false, 93 | topBound: { 94 | default: 0, 95 | visible () { 96 | return this.useBoundaries; 97 | } 98 | }, 99 | bottomBound: { 100 | default: 0, 101 | visible () { 102 | return this.useBoundaries; 103 | } 104 | }, 105 | leftBound: { 106 | default: 0, 107 | visible () { 108 | return this.useBoundaries; 109 | } 110 | }, 111 | rightBound: { 112 | default: 0, 113 | visible () { 114 | return this.useBoundaries; 115 | } 116 | } 117 | }, 118 | 119 | // use this for initialization 120 | onLoad: function () { 121 | this.startFollow = false; 122 | let canvas = cc.find('Canvas').getComponent(cc.Canvas); 123 | this.visibleSize = cc.view.getVisibleSize(); 124 | this.initZoomRatio = this.camera.zoomRatio; 125 | //place camera on target if centerAtStart 126 | if (this.centerAtStart) { 127 | this.node.position = this.target.convertToWorldSpaceAR(cc.Vec2.ZERO); 128 | } 129 | this.previousPos = this.node.position; 130 | if (this.pointerPan) { 131 | // this.jumpZoom = false; 132 | this.overview = false; 133 | this.speedZoom = false; 134 | canvas.node.on('mousemove', this.onMouseMove, this); 135 | canvas.node.on('touchmove', this.onTouchMove, this); 136 | this.pointerPos = null; 137 | } 138 | if (this.overview) { 139 | this.jumpZoom = false; 140 | this.speedZoom = false; 141 | } 142 | if (this.speedZoom) { 143 | this.jumpZoom = false; 144 | } 145 | }, 146 | 147 | onEnable: function () { 148 | cc.director.getPhysicsManager().attachDebugDrawToCamera(this.camera); 149 | }, 150 | onDisable: function () { 151 | cc.director.getPhysicsManager().detachDebugDrawFromCamera(this.camera); 152 | }, 153 | 154 | // called every frame, uncomment this function to activate update callback 155 | lateUpdate: function (dt) { 156 | let targetPos; 157 | 158 | if (this.overview){ 159 | targetPos = this.target.parent.convertToWorldSpaceAR(this.getOverviewTargetsMidpoint()); 160 | } else { 161 | targetPos = this.target.parent.convertToWorldSpaceAR(this.target.position); 162 | } 163 | 164 | if (this.pointerPan && this.pointerPos) { 165 | let xDelta = this.pointerPos.x / (this.visibleSize.width/2) - 1; 166 | let yDelta = this.pointerPos.y / (this.visibleSize.height/2) - 1; 167 | xDelta *= this.pointerXMult; 168 | yDelta *= this.pointerYMult; 169 | targetPos = cc.pAdd(targetPos, cc.p(xDelta, yDelta)); 170 | } 171 | 172 | //smooth follow 173 | if (this.smoothFollow) { 174 | if (Math.abs(targetPos.x - this.node.x) >= this.followX || 175 | Math.abs(targetPos.y - this.node.y) >= this.followY) {//when camera and target distance is larger than max distance 176 | this.startFollow = true; 177 | } 178 | if (this.startFollow) { 179 | this.node.position = this.node.position.lerp(targetPos,this.followRatio); 180 | if (cc.pDistance(targetPos, this.node.position) <= this.minFollowDist) { 181 | this.startFollow = false; 182 | } 183 | } 184 | } else { 185 | this.node.position = this.node.parent.convertToNodeSpaceAR(targetPos); 186 | } 187 | 188 | //speed zoom 189 | if (this.speedZoom) { 190 | let curSpeed = Math.abs(this.previousPos.x - targetPos.x) / dt; 191 | let ratio = 0; 192 | if (curSpeed > this.zoomOutSpeed) { 193 | ratio = 1 - (curSpeed - this.zoomOutSpeed) / (this.zoomInSpeed - this.zoomOutSpeed); 194 | this.camera.zoomRatio = cc.lerp(this.camera.zoomRatio, ratio, 0.02); 195 | } else { 196 | this.camera.zoomRatio = cc.lerp(this.camera.zoomRatio, this.initZoomRatio, 0.02); 197 | } 198 | } 199 | 200 | this.previousPos = targetPos; 201 | 202 | //jump zoom 203 | if (this.jumpZoom) { 204 | let ratio = targetPos.y / cc.winSize.height; 205 | this.camera.zoomRatio = 1 + (0.6 - ratio) * 0.35; 206 | } 207 | 208 | //boundaries 209 | 210 | if (this.useBoundaries) { 211 | let width = (this.visibleSize.width/2) / this.camera.zoomRatio; 212 | let height = (this.visibleSize.height/2) / this.camera.zoomRatio; 213 | let minX = this.node.x - width; 214 | let maxX = this.node.x + width; 215 | let minY = this.node.y - height; 216 | let maxY = this.node.y + height; 217 | if (minX < this.leftBound) { 218 | this.node.x = this.leftBound + width; 219 | } 220 | if (minY < this.bottomBound) { 221 | this.node.y = this.bottomBound + height; 222 | } 223 | if (maxX > this.rightBound) { 224 | this.node.x = this.rightBound - width; 225 | } 226 | if (maxY > this.topBound) { 227 | this.node.y = this.topBound - height; 228 | } 229 | } 230 | }, 231 | 232 | getOverviewTargetsMidpoint () { 233 | let midPoint = cc.p(0, 0); 234 | let minX = 99999, minY = 99999, maxX = -99999, maxY = -99999; 235 | for (let i = 0; i < this.overviewTargets.length; ++i) { 236 | let target = this.overviewTargets[i]; 237 | maxX = target.x > maxX ? target.x : maxX; 238 | minX = target.x < minX ? target.x : minX; 239 | maxY = target.y > maxY ? target.y : maxY; 240 | minY = target.y < minY ? target.y : minY; 241 | } 242 | maxX += this.overviewMargin; 243 | minX -= this.overviewMargin; 244 | maxY += this.overviewMargin; 245 | minY -= this.overviewMargin; 246 | let distX = Math.abs(maxX - minX); 247 | let distY = Math.abs(maxY - minY); 248 | midPoint = cc.p(minX + distX/2, minY + distY/2); 249 | let ratio = Math.max(distX / this.visibleSize.width, distY / this.visibleSize.height); 250 | this.camera.zoomRatio = 1/ratio; 251 | return midPoint; 252 | }, 253 | 254 | shakeCamera () { 255 | if (!this.canShake) return; 256 | this.anim.play('shake'); 257 | this.scheduleOnce(this.stopShake.bind(this), this.shakeDuration); 258 | }, 259 | 260 | stopShake () { 261 | this.anim.stop(); 262 | this.camera.node.position = cc.p(0, 0); 263 | }, 264 | 265 | onMouseMove (event) { 266 | this.pointerPos = event.getLocation(); 267 | }, 268 | 269 | onTouchMove (event) { 270 | this.pointerPos = event.getLocation(); 271 | } 272 | }); -------------------------------------------------------------------------------- /assets/script/CameraControl.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.4", 3 | "uuid": "d1e9361c-2f38-4e8a-8857-5fa6c78fd6b2", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/script/Global.js: -------------------------------------------------------------------------------- 1 | cc.director.getPhysicsManager().enabled = true; 2 | // cc.director.getPhysicsManager().debugDrawFlags = cc.PhysicsManager.DrawBits.e_aabbBit | 3 | // cc.PhysicsManager.DrawBits.e_pairBit | 4 | // cc.PhysicsManager.DrawBits.e_centerOfMassBit | 5 | // cc.PhysicsManager.DrawBits.e_jointBit | 6 | // cc.PhysicsManager.DrawBits.e_shapeBit 7 | // ; -------------------------------------------------------------------------------- /assets/script/Global.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.4", 3 | "uuid": "ac24b6c8-4926-497a-8ad1-13871015051a", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/script/HeroControl.js: -------------------------------------------------------------------------------- 1 | // game art from : https://openpixelproject.itch.io/opp2017sprites 2 | const CameraControl = require('CameraControl'); 3 | 4 | const MOVE_LEFT = 1; 5 | const MOVE_RIGHT = 2; 6 | 7 | cc.macro.ENABLE_TILEDMAP_CULLING = false; 8 | 9 | cc.Class({ 10 | extends: cc.Component, 11 | 12 | properties: { 13 | camera: CameraControl, 14 | maxSpeed: 500, 15 | jumps: 2, 16 | acceleration: 1500, 17 | jumpSpeed: 200, 18 | drag: 600 19 | }, 20 | 21 | // use this for initialization 22 | onLoad: function () { 23 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, this.onKeyDown, this); 24 | cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this); 25 | 26 | this._moveFlags = 0; 27 | 28 | this._up = false; 29 | 30 | this.body = this.getComponent(cc.RigidBody); 31 | this.speed = cc.p(0, 0); 32 | }, 33 | 34 | onKeyDown (event) { 35 | switch(event.keyCode) { 36 | case cc.KEY.a: 37 | case cc.KEY.left: 38 | this._moveFlags |= MOVE_LEFT; 39 | break; 40 | case cc.KEY.d: 41 | case cc.KEY.right: 42 | this._moveFlags |= MOVE_RIGHT; 43 | break; 44 | case cc.KEY.up: 45 | case cc.KEY.w: 46 | if (!this._upPressed) { 47 | this._up = true; 48 | } 49 | this._upPressed = true; 50 | break; 51 | } 52 | }, 53 | 54 | onKeyUp (event) { 55 | switch(event.keyCode) { 56 | case cc.KEY.a: 57 | case cc.KEY.left: 58 | this._moveFlags &= ~MOVE_LEFT; 59 | break; 60 | case cc.KEY.d: 61 | case cc.KEY.right: 62 | this._moveFlags &= ~MOVE_RIGHT; 63 | break; 64 | case cc.KEY.up: 65 | case cc.KEY.w: 66 | this._upPressed = false; 67 | break; 68 | } 69 | }, 70 | 71 | onBeginContact: function (contact, selfCollider, otherCollider) { 72 | if (selfCollider.node.y > otherCollider.node.y) { 73 | this.jumps = 2; 74 | } 75 | 76 | if (otherCollider.tag === 100) { 77 | this.camera.shakeCamera(); 78 | } 79 | }, 80 | 81 | // called every frame, uncomment this function to activate update callback 82 | update: function (dt) { 83 | this.speed = this.body.linearVelocity; 84 | 85 | if(this._moveFlags === MOVE_LEFT) { 86 | // this.anim.play('walk'); 87 | 88 | if(this.node.scaleX > 0) { 89 | this.node.scaleX *= -1; 90 | } 91 | 92 | this.speed.x -= this.acceleration * dt; 93 | if(this.speed.x < -this.maxSpeed) { 94 | this.speed.x = -this.maxSpeed; 95 | } 96 | } 97 | else if (this._moveFlags === MOVE_RIGHT) { 98 | // this.anim.play('walk'); 99 | 100 | if(this.node.scaleX < 0) { 101 | this.node.scaleX *= -1; 102 | } 103 | 104 | this.speed.x += this.acceleration * dt; 105 | if(this.speed.x > this.maxSpeed) { 106 | this.speed.x = this.maxSpeed; 107 | } 108 | } 109 | else { 110 | if(this.speed.x !== 0) { 111 | var d = this.drag * dt; 112 | if(Math.abs(this.speed.x) <= d) { 113 | this.speed.x = 0; 114 | // this.anim.play('idle'); 115 | } else { 116 | this.speed.x -= this.speed.x > 0 ? d : -d; 117 | } 118 | } 119 | } 120 | 121 | if (this.jumps > 0 && this._up) { 122 | this.speed.y = this.jumpSpeed; 123 | this.jumps--; 124 | } 125 | 126 | this._up = false; 127 | this.body.linearVelocity = this.speed; 128 | }, 129 | }); 130 | -------------------------------------------------------------------------------- /assets/script/HeroControl.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.4", 3 | "uuid": "6fc86460-9cf9-4f8c-b38b-f31fce553988", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/script/TweenLite.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * VERSION: 1.19.1 3 | * DATE: 2017-01-17 4 | * UPDATES AND DOCS AT: http://greensock.com 5 | * 6 | * @license Copyright (c) 2008-2017, GreenSock. All rights reserved. 7 | * This work is subject to the terms at http://greensock.com/standard-license or for 8 | * Club GreenSock members, the software agreement that was issued with your membership. 9 | * 10 | * @author: Jack Doyle, jack@greensock.com 11 | */ 12 | (function(window, moduleName) { 13 | 14 | "use strict"; 15 | var _exports = {}, 16 | _doc = window.document, 17 | _globals = window.GreenSockGlobals = window.GreenSockGlobals || window; 18 | if (_globals.TweenLite) { 19 | return; //in case the core set of classes is already loaded, don't instantiate twice. 20 | } 21 | var _namespace = function(ns) { 22 | var a = ns.split("."), 23 | p = _globals, i; 24 | for (i = 0; i < a.length; i++) { 25 | p[a[i]] = p = p[a[i]] || {}; 26 | } 27 | return p; 28 | }, 29 | gs = _namespace("com.greensock"), 30 | _tinyNum = 0.0000000001, 31 | _slice = function(a) { //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() 32 | var b = [], 33 | l = a.length, 34 | i; 35 | for (i = 0; i !== l; b.push(a[i++])) {} 36 | return b; 37 | }, 38 | _emptyFunc = function() {}, 39 | _isArray = (function() { //works around issues in iframe environments where the Array global isn't shared, thus if the object originates in a different window/iframe, "(obj instanceof Array)" will evaluate false. We added some speed optimizations to avoid Object.prototype.toString.call() unless it's absolutely necessary because it's VERY slow (like 20x slower) 40 | var toString = Object.prototype.toString, 41 | array = toString.call([]); 42 | return function(obj) { 43 | return obj != null && (obj instanceof Array || (typeof(obj) === "object" && !!obj.push && toString.call(obj) === array)); 44 | }; 45 | }()), 46 | a, i, p, _ticker, _tickerActive, 47 | _defLookup = {}, 48 | 49 | /** 50 | * @constructor 51 | * Defines a GreenSock class, optionally with an array of dependencies that must be instantiated first and passed into the definition. 52 | * This allows users to load GreenSock JS files in any order even if they have interdependencies (like CSSPlugin extends TweenPlugin which is 53 | * inside TweenLite.js, but if CSSPlugin is loaded first, it should wait to run its code until TweenLite.js loads and instantiates TweenPlugin 54 | * and then pass TweenPlugin to CSSPlugin's definition). This is all done automatically and internally. 55 | * 56 | * Every definition will be added to a "com.greensock" global object (typically window, but if a window.GreenSockGlobals object is found, 57 | * it will go there as of v1.7). For example, TweenLite will be found at window.com.greensock.TweenLite and since it's a global class that should be available anywhere, 58 | * it is ALSO referenced at window.TweenLite. However some classes aren't considered global, like the base com.greensock.core.Animation class, so 59 | * those will only be at the package like window.com.greensock.core.Animation. Again, if you define a GreenSockGlobals object on the window, everything 60 | * gets tucked neatly inside there instead of on the window directly. This allows you to do advanced things like load multiple versions of GreenSock 61 | * files and put them into distinct objects (imagine a banner ad uses a newer version but the main site uses an older one). In that case, you could 62 | * sandbox the banner one like: 63 | * 64 | * 67 | * 68 | * 71 | * 72 | * 76 | * 77 | * @param {!string} ns The namespace of the class definition, leaving off "com.greensock." as that's assumed. For example, "TweenLite" or "plugins.CSSPlugin" or "easing.Back". 78 | * @param {!Array.} dependencies An array of dependencies (described as their namespaces minus "com.greensock." prefix). For example ["TweenLite","plugins.TweenPlugin","core.Animation"] 79 | * @param {!function():Object} func The function that should be called and passed the resolved dependencies which will return the actual class for this definition. 80 | * @param {boolean=} global If true, the class will be added to the global scope (typically window unless you define a window.GreenSockGlobals object) 81 | */ 82 | Definition = function(ns, dependencies, func, global) { 83 | this.sc = (_defLookup[ns]) ? _defLookup[ns].sc : []; //subclasses 84 | _defLookup[ns] = this; 85 | this.gsClass = null; 86 | this.func = func; 87 | var _classes = []; 88 | this.check = function(init) { 89 | var i = dependencies.length, 90 | missing = i, 91 | cur, a, n, cl, hasModule; 92 | while (--i > -1) { 93 | if ((cur = _defLookup[dependencies[i]] || new Definition(dependencies[i], [])).gsClass) { 94 | _classes[i] = cur.gsClass; 95 | missing--; 96 | } else if (init) { 97 | cur.sc.push(this); 98 | } 99 | } 100 | if (missing === 0 && func) { 101 | a = ("com.greensock." + ns).split("."); 102 | n = a.pop(); 103 | cl = _namespace(a.join("."))[n] = this.gsClass = func.apply(func, _classes); 104 | 105 | //exports to multiple environments 106 | if (global) { 107 | _globals[n] = _exports[n] = cl; //provides a way to avoid global namespace pollution. By default, the main classes like TweenLite, Power1, Strong, etc. are added to window unless a GreenSockGlobals is defined. So if you want to have things added to a custom object instead, just do something like window.GreenSockGlobals = {} before loading any GreenSock files. You can even set up an alias like window.GreenSockGlobals = windows.gs = {} so that you can access everything like gs.TweenLite. Also remember that ALL classes are added to the window.com.greensock object (in their respective packages, like com.greensock.easing.Power1, com.greensock.TweenLite, etc.) 108 | hasModule = (typeof(module) !== "undefined" && module.exports); 109 | if (!hasModule && typeof(define) === "function" && define.amd){ //AMD 110 | define((window.GreenSockAMDPath ? window.GreenSockAMDPath + "/" : "") + ns.split(".").pop(), [], function() { return cl; }); 111 | } else if (hasModule){ //node 112 | if (ns === moduleName) { 113 | module.exports = _exports[moduleName] = cl; 114 | for (i in _exports) { 115 | cl[i] = _exports[i]; 116 | } 117 | } else if (_exports[moduleName]) { 118 | _exports[moduleName][n] = cl; 119 | } 120 | } 121 | } 122 | for (i = 0; i < this.sc.length; i++) { 123 | this.sc[i].check(); 124 | } 125 | } 126 | }; 127 | this.check(true); 128 | }, 129 | 130 | //used to create Definition instances (which basically registers a class that has dependencies). 131 | _gsDefine = window._gsDefine = function(ns, dependencies, func, global) { 132 | return new Definition(ns, dependencies, func, global); 133 | }, 134 | 135 | //a quick way to create a class that doesn't have any dependencies. Returns the class, but first registers it in the GreenSock namespace so that other classes can grab it (other classes might be dependent on the class). 136 | _class = gs._class = function(ns, func, global) { 137 | func = func || function() {}; 138 | _gsDefine(ns, [], function(){ return func; }, global); 139 | return func; 140 | }; 141 | 142 | _gsDefine.globals = _globals; 143 | 144 | 145 | 146 | /* 147 | * ---------------------------------------------------------------- 148 | * Ease 149 | * ---------------------------------------------------------------- 150 | */ 151 | var _baseParams = [0, 0, 1, 1], 152 | _blankArray = [], 153 | Ease = _class("easing.Ease", function(func, extraParams, type, power) { 154 | this._func = func; 155 | this._type = type || 0; 156 | this._power = power || 0; 157 | this._params = extraParams ? _baseParams.concat(extraParams) : _baseParams; 158 | }, true), 159 | _easeMap = Ease.map = {}, 160 | _easeReg = Ease.register = function(ease, names, types, create) { 161 | var na = names.split(","), 162 | i = na.length, 163 | ta = (types || "easeIn,easeOut,easeInOut").split(","), 164 | e, name, j, type; 165 | while (--i > -1) { 166 | name = na[i]; 167 | e = create ? _class("easing."+name, null, true) : gs.easing[name] || {}; 168 | j = ta.length; 169 | while (--j > -1) { 170 | type = ta[j]; 171 | _easeMap[name + "." + type] = _easeMap[type + name] = e[type] = ease.getRatio ? ease : ease[type] || new ease(); 172 | } 173 | } 174 | }; 175 | 176 | p = Ease.prototype; 177 | p._calcEnd = false; 178 | p.getRatio = function(p) { 179 | if (this._func) { 180 | this._params[0] = p; 181 | return this._func.apply(null, this._params); 182 | } 183 | var t = this._type, 184 | pw = this._power, 185 | r = (t === 1) ? 1 - p : (t === 2) ? p : (p < 0.5) ? p * 2 : (1 - p) * 2; 186 | if (pw === 1) { 187 | r *= r; 188 | } else if (pw === 2) { 189 | r *= r * r; 190 | } else if (pw === 3) { 191 | r *= r * r * r; 192 | } else if (pw === 4) { 193 | r *= r * r * r * r; 194 | } 195 | return (t === 1) ? 1 - r : (t === 2) ? r : (p < 0.5) ? r / 2 : 1 - (r / 2); 196 | }; 197 | 198 | //create all the standard eases like Linear, Quad, Cubic, Quart, Quint, Strong, Power0, Power1, Power2, Power3, and Power4 (each with easeIn, easeOut, and easeInOut) 199 | a = ["Linear","Quad","Cubic","Quart","Quint,Strong"]; 200 | i = a.length; 201 | while (--i > -1) { 202 | p = a[i]+",Power"+i; 203 | _easeReg(new Ease(null,null,1,i), p, "easeOut", true); 204 | _easeReg(new Ease(null,null,2,i), p, "easeIn" + ((i === 0) ? ",easeNone" : "")); 205 | _easeReg(new Ease(null,null,3,i), p, "easeInOut"); 206 | } 207 | _easeMap.linear = gs.easing.Linear.easeIn; 208 | _easeMap.swing = gs.easing.Quad.easeInOut; //for jQuery folks 209 | 210 | 211 | /* 212 | * ---------------------------------------------------------------- 213 | * EventDispatcher 214 | * ---------------------------------------------------------------- 215 | */ 216 | var EventDispatcher = _class("events.EventDispatcher", function(target) { 217 | this._listeners = {}; 218 | this._eventTarget = target || this; 219 | }); 220 | p = EventDispatcher.prototype; 221 | 222 | p.addEventListener = function(type, callback, scope, useParam, priority) { 223 | priority = priority || 0; 224 | var list = this._listeners[type], 225 | index = 0, 226 | listener, i; 227 | if (this === _ticker && !_tickerActive) { 228 | _ticker.wake(); 229 | } 230 | if (list == null) { 231 | this._listeners[type] = list = []; 232 | } 233 | i = list.length; 234 | while (--i > -1) { 235 | listener = list[i]; 236 | if (listener.c === callback && listener.s === scope) { 237 | list.splice(i, 1); 238 | } else if (index === 0 && listener.pr < priority) { 239 | index = i + 1; 240 | } 241 | } 242 | list.splice(index, 0, {c:callback, s:scope, up:useParam, pr:priority}); 243 | }; 244 | 245 | p.removeEventListener = function(type, callback) { 246 | var list = this._listeners[type], i; 247 | if (list) { 248 | i = list.length; 249 | while (--i > -1) { 250 | if (list[i].c === callback) { 251 | list.splice(i, 1); 252 | return; 253 | } 254 | } 255 | } 256 | }; 257 | 258 | p.dispatchEvent = function(type) { 259 | var list = this._listeners[type], 260 | i, t, listener; 261 | if (list) { 262 | i = list.length; 263 | if (i > 1) { 264 | list = list.slice(0); //in case addEventListener() is called from within a listener/callback (otherwise the index could change, resulting in a skip) 265 | } 266 | t = this._eventTarget; 267 | while (--i > -1) { 268 | listener = list[i]; 269 | if (listener) { 270 | if (listener.up) { 271 | listener.c.call(listener.s || t, {type:type, target:t}); 272 | } else { 273 | listener.c.call(listener.s || t); 274 | } 275 | } 276 | } 277 | } 278 | }; 279 | 280 | 281 | /* 282 | * ---------------------------------------------------------------- 283 | * Ticker 284 | * ---------------------------------------------------------------- 285 | */ 286 | var _reqAnimFrame = window.requestAnimationFrame, 287 | _cancelAnimFrame = window.cancelAnimationFrame, 288 | _getTime = Date.now || function() {return new Date().getTime();}, 289 | _lastUpdate = _getTime(); 290 | 291 | //now try to determine the requestAnimationFrame and cancelAnimationFrame functions and if none are found, we'll use a setTimeout()/clearTimeout() polyfill. 292 | a = ["ms","moz","webkit","o"]; 293 | i = a.length; 294 | while (--i > -1 && !_reqAnimFrame) { 295 | _reqAnimFrame = window[a[i] + "RequestAnimationFrame"]; 296 | _cancelAnimFrame = window[a[i] + "CancelAnimationFrame"] || window[a[i] + "CancelRequestAnimationFrame"]; 297 | } 298 | 299 | _class("Ticker", function(fps, useRAF) { 300 | var _self = this, 301 | _startTime = _getTime(), 302 | _useRAF = (useRAF !== false && _reqAnimFrame) ? "auto" : false, 303 | _lagThreshold = 500, 304 | _adjustedLag = 33, 305 | _tickWord = "tick", //helps reduce gc burden 306 | _fps, _req, _id, _gap, _nextTime, 307 | _tick = function(manual) { 308 | var elapsed = _getTime() - _lastUpdate, 309 | overlap, dispatch; 310 | if (elapsed > _lagThreshold) { 311 | _startTime += elapsed - _adjustedLag; 312 | } 313 | _lastUpdate += elapsed; 314 | _self.time = (_lastUpdate - _startTime) / 1000; 315 | overlap = _self.time - _nextTime; 316 | if (!_fps || overlap > 0 || manual === true) { 317 | _self.frame++; 318 | _nextTime += overlap + (overlap >= _gap ? 0.004 : _gap - overlap); 319 | dispatch = true; 320 | } 321 | if (manual !== true) { //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. 322 | _id = _req(_tick); 323 | } 324 | if (dispatch) { 325 | _self.dispatchEvent(_tickWord); 326 | } 327 | }; 328 | 329 | EventDispatcher.call(_self); 330 | _self.time = _self.frame = 0; 331 | _self.tick = function() { 332 | _tick(true); 333 | }; 334 | 335 | _self.lagSmoothing = function(threshold, adjustedLag) { 336 | _lagThreshold = threshold || (1 / _tinyNum); //zero should be interpreted as basically unlimited 337 | _adjustedLag = Math.min(adjustedLag, _lagThreshold, 0); 338 | }; 339 | 340 | _self.sleep = function() { 341 | if (_id == null) { 342 | return; 343 | } 344 | if (!_useRAF || !_cancelAnimFrame) { 345 | clearTimeout(_id); 346 | } else { 347 | _cancelAnimFrame(_id); 348 | } 349 | _req = _emptyFunc; 350 | _id = null; 351 | if (_self === _ticker) { 352 | _tickerActive = false; 353 | } 354 | }; 355 | 356 | _self.wake = function(seamless) { 357 | if (_id !== null) { 358 | _self.sleep(); 359 | } else if (seamless) { 360 | _startTime += -_lastUpdate + (_lastUpdate = _getTime()); 361 | } else if (_self.frame > 10) { //don't trigger lagSmoothing if we're just waking up, and make sure that at least 10 frames have elapsed because of the iOS bug that we work around below with the 1.5-second setTimout(). 362 | _lastUpdate = _getTime() - _lagThreshold + 5; 363 | } 364 | _req = (_fps === 0) ? _emptyFunc : (!_useRAF || !_reqAnimFrame) ? function(f) { return setTimeout(f, ((_nextTime - _self.time) * 1000 + 1) | 0); } : _reqAnimFrame; 365 | if (_self === _ticker) { 366 | _tickerActive = true; 367 | } 368 | _tick(2); 369 | }; 370 | 371 | _self.fps = function(value) { 372 | if (!arguments.length) { 373 | return _fps; 374 | } 375 | _fps = value; 376 | _gap = 1 / (_fps || 60); 377 | _nextTime = this.time + _gap; 378 | _self.wake(); 379 | }; 380 | 381 | _self.useRAF = function(value) { 382 | if (!arguments.length) { 383 | return _useRAF; 384 | } 385 | _self.sleep(); 386 | _useRAF = value; 387 | _self.fps(_fps); 388 | }; 389 | _self.fps(fps); 390 | 391 | //a bug in iOS 6 Safari occasionally prevents the requestAnimationFrame from working initially, so we use a 1.5-second timeout that automatically falls back to setTimeout() if it senses this condition. 392 | setTimeout(function() { 393 | if (_useRAF === "auto" && _self.frame < 5 && _doc.visibilityState !== "hidden") { 394 | _self.useRAF(false); 395 | } 396 | }, 1500); 397 | }); 398 | 399 | p = gs.Ticker.prototype = new gs.events.EventDispatcher(); 400 | p.constructor = gs.Ticker; 401 | 402 | 403 | /* 404 | * ---------------------------------------------------------------- 405 | * Animation 406 | * ---------------------------------------------------------------- 407 | */ 408 | var Animation = _class("core.Animation", function(duration, vars) { 409 | this.vars = vars = vars || {}; 410 | this._duration = this._totalDuration = duration || 0; 411 | this._delay = Number(vars.delay) || 0; 412 | this._timeScale = 1; 413 | this._active = (vars.immediateRender === true); 414 | this.data = vars.data; 415 | this._reversed = (vars.reversed === true); 416 | 417 | if (!_rootTimeline) { 418 | return; 419 | } 420 | if (!_tickerActive) { //some browsers (like iOS 6 Safari) shut down JavaScript execution when the tab is disabled and they [occasionally] neglect to start up requestAnimationFrame again when returning - this code ensures that the engine starts up again properly. 421 | _ticker.wake(); 422 | } 423 | 424 | var tl = this.vars.useFrames ? _rootFramesTimeline : _rootTimeline; 425 | tl.add(this, tl._time); 426 | 427 | if (this.vars.paused) { 428 | this.paused(true); 429 | } 430 | }); 431 | 432 | _ticker = Animation.ticker = new gs.Ticker(); 433 | p = Animation.prototype; 434 | p._dirty = p._gc = p._initted = p._paused = false; 435 | p._totalTime = p._time = 0; 436 | p._rawPrevTime = -1; 437 | p._next = p._last = p._onUpdate = p._timeline = p.timeline = null; 438 | p._paused = false; 439 | 440 | 441 | //some browsers (like iOS) occasionally drop the requestAnimationFrame event when the user switches to a different tab and then comes back again, so we use a 2-second setTimeout() to sense if/when that condition occurs and then wake() the ticker. 442 | var _checkTimeout = function() { 443 | if (_tickerActive && _getTime() - _lastUpdate > 2000) { 444 | _ticker.wake(); 445 | } 446 | setTimeout(_checkTimeout, 2000); 447 | }; 448 | _checkTimeout(); 449 | 450 | 451 | p.play = function(from, suppressEvents) { 452 | if (from != null) { 453 | this.seek(from, suppressEvents); 454 | } 455 | return this.reversed(false).paused(false); 456 | }; 457 | 458 | p.pause = function(atTime, suppressEvents) { 459 | if (atTime != null) { 460 | this.seek(atTime, suppressEvents); 461 | } 462 | return this.paused(true); 463 | }; 464 | 465 | p.resume = function(from, suppressEvents) { 466 | if (from != null) { 467 | this.seek(from, suppressEvents); 468 | } 469 | return this.paused(false); 470 | }; 471 | 472 | p.seek = function(time, suppressEvents) { 473 | return this.totalTime(Number(time), suppressEvents !== false); 474 | }; 475 | 476 | p.restart = function(includeDelay, suppressEvents) { 477 | return this.reversed(false).paused(false).totalTime(includeDelay ? -this._delay : 0, (suppressEvents !== false), true); 478 | }; 479 | 480 | p.reverse = function(from, suppressEvents) { 481 | if (from != null) { 482 | this.seek((from || this.totalDuration()), suppressEvents); 483 | } 484 | return this.reversed(true).paused(false); 485 | }; 486 | 487 | p.render = function(time, suppressEvents, force) { 488 | //stub - we override this method in subclasses. 489 | }; 490 | 491 | p.invalidate = function() { 492 | this._time = this._totalTime = 0; 493 | this._initted = this._gc = false; 494 | this._rawPrevTime = -1; 495 | if (this._gc || !this.timeline) { 496 | this._enabled(true); 497 | } 498 | return this; 499 | }; 500 | 501 | p.isActive = function() { 502 | var tl = this._timeline, //the 2 root timelines won't have a _timeline; they're always active. 503 | startTime = this._startTime, 504 | rawTime; 505 | return (!tl || (!this._gc && !this._paused && tl.isActive() && (rawTime = tl.rawTime(true)) >= startTime && rawTime < startTime + this.totalDuration() / this._timeScale)); 506 | }; 507 | 508 | p._enabled = function (enabled, ignoreTimeline) { 509 | if (!_tickerActive) { 510 | _ticker.wake(); 511 | } 512 | this._gc = !enabled; 513 | this._active = this.isActive(); 514 | if (ignoreTimeline !== true) { 515 | if (enabled && !this.timeline) { 516 | this._timeline.add(this, this._startTime - this._delay); 517 | } else if (!enabled && this.timeline) { 518 | this._timeline._remove(this, true); 519 | } 520 | } 521 | return false; 522 | }; 523 | 524 | 525 | p._kill = function(vars, target) { 526 | return this._enabled(false, false); 527 | }; 528 | 529 | p.kill = function(vars, target) { 530 | this._kill(vars, target); 531 | return this; 532 | }; 533 | 534 | p._uncache = function(includeSelf) { 535 | var tween = includeSelf ? this : this.timeline; 536 | while (tween) { 537 | tween._dirty = true; 538 | tween = tween.timeline; 539 | } 540 | return this; 541 | }; 542 | 543 | p._swapSelfInParams = function(params) { 544 | var i = params.length, 545 | copy = params.concat(); 546 | while (--i > -1) { 547 | if (params[i] === "{self}") { 548 | copy[i] = this; 549 | } 550 | } 551 | return copy; 552 | }; 553 | 554 | p._callback = function(type) { 555 | var v = this.vars, 556 | callback = v[type], 557 | params = v[type + "Params"], 558 | scope = v[type + "Scope"] || v.callbackScope || this, 559 | l = params ? params.length : 0; 560 | switch (l) { //speed optimization; call() is faster than apply() so use it when there are only a few parameters (which is by far most common). Previously we simply did var v = this.vars; v[type].apply(v[type + "Scope"] || v.callbackScope || this, v[type + "Params"] || _blankArray); 561 | case 0: callback.call(scope); break; 562 | case 1: callback.call(scope, params[0]); break; 563 | case 2: callback.call(scope, params[0], params[1]); break; 564 | default: callback.apply(scope, params); 565 | } 566 | }; 567 | 568 | //----Animation getters/setters -------------------------------------------------------- 569 | 570 | p.eventCallback = function(type, callback, params, scope) { 571 | if ((type || "").substr(0,2) === "on") { 572 | var v = this.vars; 573 | if (arguments.length === 1) { 574 | return v[type]; 575 | } 576 | if (callback == null) { 577 | delete v[type]; 578 | } else { 579 | v[type] = callback; 580 | v[type + "Params"] = (_isArray(params) && params.join("").indexOf("{self}") !== -1) ? this._swapSelfInParams(params) : params; 581 | v[type + "Scope"] = scope; 582 | } 583 | if (type === "onUpdate") { 584 | this._onUpdate = callback; 585 | } 586 | } 587 | return this; 588 | }; 589 | 590 | p.delay = function(value) { 591 | if (!arguments.length) { 592 | return this._delay; 593 | } 594 | if (this._timeline.smoothChildTiming) { 595 | this.startTime( this._startTime + value - this._delay ); 596 | } 597 | this._delay = value; 598 | return this; 599 | }; 600 | 601 | p.duration = function(value) { 602 | if (!arguments.length) { 603 | this._dirty = false; 604 | return this._duration; 605 | } 606 | this._duration = this._totalDuration = value; 607 | this._uncache(true); //true in case it's a TweenMax or TimelineMax that has a repeat - we'll need to refresh the totalDuration. 608 | if (this._timeline.smoothChildTiming) if (this._time > 0) if (this._time < this._duration) if (value !== 0) { 609 | this.totalTime(this._totalTime * (value / this._duration), true); 610 | } 611 | return this; 612 | }; 613 | 614 | p.totalDuration = function(value) { 615 | this._dirty = false; 616 | return (!arguments.length) ? this._totalDuration : this.duration(value); 617 | }; 618 | 619 | p.time = function(value, suppressEvents) { 620 | if (!arguments.length) { 621 | return this._time; 622 | } 623 | if (this._dirty) { 624 | this.totalDuration(); 625 | } 626 | return this.totalTime((value > this._duration) ? this._duration : value, suppressEvents); 627 | }; 628 | 629 | p.totalTime = function(time, suppressEvents, uncapped) { 630 | if (!_tickerActive) { 631 | _ticker.wake(); 632 | } 633 | if (!arguments.length) { 634 | return this._totalTime; 635 | } 636 | if (this._timeline) { 637 | if (time < 0 && !uncapped) { 638 | time += this.totalDuration(); 639 | } 640 | if (this._timeline.smoothChildTiming) { 641 | if (this._dirty) { 642 | this.totalDuration(); 643 | } 644 | var totalDuration = this._totalDuration, 645 | tl = this._timeline; 646 | if (time > totalDuration && !uncapped) { 647 | time = totalDuration; 648 | } 649 | this._startTime = (this._paused ? this._pauseTime : tl._time) - ((!this._reversed ? time : totalDuration - time) / this._timeScale); 650 | if (!tl._dirty) { //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. 651 | this._uncache(false); 652 | } 653 | //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The startTime of that child would get pushed out, but one of the ancestors may have completed. 654 | if (tl._timeline) { 655 | while (tl._timeline) { 656 | if (tl._timeline._time !== (tl._startTime + tl._totalTime) / tl._timeScale) { 657 | tl.totalTime(tl._totalTime, true); 658 | } 659 | tl = tl._timeline; 660 | } 661 | } 662 | } 663 | if (this._gc) { 664 | this._enabled(true, false); 665 | } 666 | if (this._totalTime !== time || this._duration === 0) { 667 | if (_lazyTweens.length) { 668 | _lazyRender(); 669 | } 670 | this.render(time, suppressEvents, false); 671 | if (_lazyTweens.length) { //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. 672 | _lazyRender(); 673 | } 674 | } 675 | } 676 | return this; 677 | }; 678 | 679 | p.progress = p.totalProgress = function(value, suppressEvents) { 680 | var duration = this.duration(); 681 | return (!arguments.length) ? (duration ? this._time / duration : this.ratio) : this.totalTime(duration * value, suppressEvents); 682 | }; 683 | 684 | p.startTime = function(value) { 685 | if (!arguments.length) { 686 | return this._startTime; 687 | } 688 | if (value !== this._startTime) { 689 | this._startTime = value; 690 | if (this.timeline) if (this.timeline._sortChildren) { 691 | this.timeline.add(this, value - this._delay); //ensures that any necessary re-sequencing of Animations in the timeline occurs to make sure the rendering order is correct. 692 | } 693 | } 694 | return this; 695 | }; 696 | 697 | p.endTime = function(includeRepeats) { 698 | return this._startTime + ((includeRepeats != false) ? this.totalDuration() : this.duration()) / this._timeScale; 699 | }; 700 | 701 | p.timeScale = function(value) { 702 | if (!arguments.length) { 703 | return this._timeScale; 704 | } 705 | value = value || _tinyNum; //can't allow zero because it'll throw the math off 706 | if (this._timeline && this._timeline.smoothChildTiming) { 707 | var pauseTime = this._pauseTime, 708 | t = (pauseTime || pauseTime === 0) ? pauseTime : this._timeline.totalTime(); 709 | this._startTime = t - ((t - this._startTime) * this._timeScale / value); 710 | } 711 | this._timeScale = value; 712 | return this._uncache(false); 713 | }; 714 | 715 | p.reversed = function(value) { 716 | if (!arguments.length) { 717 | return this._reversed; 718 | } 719 | if (value != this._reversed) { 720 | this._reversed = value; 721 | this.totalTime(((this._timeline && !this._timeline.smoothChildTiming) ? this.totalDuration() - this._totalTime : this._totalTime), true); 722 | } 723 | return this; 724 | }; 725 | 726 | p.paused = function(value) { 727 | if (!arguments.length) { 728 | return this._paused; 729 | } 730 | var tl = this._timeline, 731 | raw, elapsed; 732 | if (value != this._paused) if (tl) { 733 | if (!_tickerActive && !value) { 734 | _ticker.wake(); 735 | } 736 | raw = tl.rawTime(); 737 | elapsed = raw - this._pauseTime; 738 | if (!value && tl.smoothChildTiming) { 739 | this._startTime += elapsed; 740 | this._uncache(false); 741 | } 742 | this._pauseTime = value ? raw : null; 743 | this._paused = value; 744 | this._active = this.isActive(); 745 | if (!value && elapsed !== 0 && this._initted && this.duration()) { 746 | raw = tl.smoothChildTiming ? this._totalTime : (raw - this._startTime) / this._timeScale; 747 | this.render(raw, (raw === this._totalTime), true); //in case the target's properties changed via some other tween or manual update by the user, we should force a render. 748 | } 749 | } 750 | if (this._gc && !value) { 751 | this._enabled(true, false); 752 | } 753 | return this; 754 | }; 755 | 756 | 757 | /* 758 | * ---------------------------------------------------------------- 759 | * SimpleTimeline 760 | * ---------------------------------------------------------------- 761 | */ 762 | var SimpleTimeline = _class("core.SimpleTimeline", function(vars) { 763 | Animation.call(this, 0, vars); 764 | this.autoRemoveChildren = this.smoothChildTiming = true; 765 | }); 766 | 767 | p = SimpleTimeline.prototype = new Animation(); 768 | p.constructor = SimpleTimeline; 769 | p.kill()._gc = false; 770 | p._first = p._last = p._recent = null; 771 | p._sortChildren = false; 772 | 773 | p.add = p.insert = function(child, position, align, stagger) { 774 | var prevTween, st; 775 | child._startTime = Number(position || 0) + child._delay; 776 | if (child._paused) if (this !== child._timeline) { //we only adjust the _pauseTime if it wasn't in this timeline already. Remember, sometimes a tween will be inserted again into the same timeline when its startTime is changed so that the tweens in the TimelineLite/Max are re-ordered properly in the linked list (so everything renders in the proper order). 777 | child._pauseTime = child._startTime + ((this.rawTime() - child._startTime) / child._timeScale); 778 | } 779 | if (child.timeline) { 780 | child.timeline._remove(child, true); //removes from existing timeline so that it can be properly added to this one. 781 | } 782 | child.timeline = child._timeline = this; 783 | if (child._gc) { 784 | child._enabled(true, true); 785 | } 786 | prevTween = this._last; 787 | if (this._sortChildren) { 788 | st = child._startTime; 789 | while (prevTween && prevTween._startTime > st) { 790 | prevTween = prevTween._prev; 791 | } 792 | } 793 | if (prevTween) { 794 | child._next = prevTween._next; 795 | prevTween._next = child; 796 | } else { 797 | child._next = this._first; 798 | this._first = child; 799 | } 800 | if (child._next) { 801 | child._next._prev = child; 802 | } else { 803 | this._last = child; 804 | } 805 | child._prev = prevTween; 806 | this._recent = child; 807 | if (this._timeline) { 808 | this._uncache(true); 809 | } 810 | return this; 811 | }; 812 | 813 | p._remove = function(tween, skipDisable) { 814 | if (tween.timeline === this) { 815 | if (!skipDisable) { 816 | tween._enabled(false, true); 817 | } 818 | 819 | if (tween._prev) { 820 | tween._prev._next = tween._next; 821 | } else if (this._first === tween) { 822 | this._first = tween._next; 823 | } 824 | if (tween._next) { 825 | tween._next._prev = tween._prev; 826 | } else if (this._last === tween) { 827 | this._last = tween._prev; 828 | } 829 | tween._next = tween._prev = tween.timeline = null; 830 | if (tween === this._recent) { 831 | this._recent = this._last; 832 | } 833 | 834 | if (this._timeline) { 835 | this._uncache(true); 836 | } 837 | } 838 | return this; 839 | }; 840 | 841 | p.render = function(time, suppressEvents, force) { 842 | var tween = this._first, 843 | next; 844 | this._totalTime = this._time = this._rawPrevTime = time; 845 | while (tween) { 846 | next = tween._next; //record it here because the value could change after rendering... 847 | if (tween._active || (time >= tween._startTime && !tween._paused)) { 848 | if (!tween._reversed) { 849 | tween.render((time - tween._startTime) * tween._timeScale, suppressEvents, force); 850 | } else { 851 | tween.render(((!tween._dirty) ? tween._totalDuration : tween.totalDuration()) - ((time - tween._startTime) * tween._timeScale), suppressEvents, force); 852 | } 853 | } 854 | tween = next; 855 | } 856 | }; 857 | 858 | p.rawTime = function() { 859 | if (!_tickerActive) { 860 | _ticker.wake(); 861 | } 862 | return this._totalTime; 863 | }; 864 | 865 | /* 866 | * ---------------------------------------------------------------- 867 | * TweenLite 868 | * ---------------------------------------------------------------- 869 | */ 870 | var TweenLite = _class("TweenLite", function(target, duration, vars) { 871 | Animation.call(this, duration, vars); 872 | this.render = TweenLite.prototype.render; //speed optimization (avoid prototype lookup on this "hot" method) 873 | 874 | if (target == null) { 875 | throw "Cannot tween a null target."; 876 | } 877 | 878 | this.target = target = (typeof(target) !== "string") ? target : TweenLite.selector(target) || target; 879 | 880 | var isSelector = (target.jquery || (target.length && target !== window && target[0] && (target[0] === window || (target[0].nodeType && target[0].style && !target.nodeType)))), 881 | overwrite = this.vars.overwrite, 882 | i, targ, targets; 883 | 884 | this._overwrite = overwrite = (overwrite == null) ? _overwriteLookup[TweenLite.defaultOverwrite] : (typeof(overwrite) === "number") ? overwrite >> 0 : _overwriteLookup[overwrite]; 885 | 886 | if ((isSelector || target instanceof Array || (target.push && _isArray(target))) && typeof(target[0]) !== "number") { 887 | this._targets = targets = _slice(target); //don't use Array.prototype.slice.call(target, 0) because that doesn't work in IE8 with a NodeList that's returned by querySelectorAll() 888 | this._propLookup = []; 889 | this._siblings = []; 890 | for (i = 0; i < targets.length; i++) { 891 | targ = targets[i]; 892 | if (!targ) { 893 | targets.splice(i--, 1); 894 | continue; 895 | } else if (typeof(targ) === "string") { 896 | targ = targets[i--] = TweenLite.selector(targ); //in case it's an array of strings 897 | if (typeof(targ) === "string") { 898 | targets.splice(i+1, 1); //to avoid an endless loop (can't imagine why the selector would return a string, but just in case) 899 | } 900 | continue; 901 | } else if (targ.length && targ !== window && targ[0] && (targ[0] === window || (targ[0].nodeType && targ[0].style && !targ.nodeType))) { //in case the user is passing in an array of selector objects (like jQuery objects), we need to check one more level and pull things out if necessary. Also note that