Commit 19972418 authored by Đặng Minh Chiến's avatar Đặng Minh Chiến

Initial commit

parents
Pipeline #1741 failed with stages
#/////////////////////////////////////////////////////////////////////////////
# Fireball Projects
#/////////////////////////////////////////////////////////////////////////////
/library/
/temp/
/local/
/build/
native
#/////////////////////////////////////////////////////////////////////////////
# npm files
#/////////////////////////////////////////////////////////////////////////////
npm-debug.log
node_modules/
#/////////////////////////////////////////////////////////////////////////////
# Logs and databases
#/////////////////////////////////////////////////////////////////////////////
*.log
*.sql
*.sqlite
#/////////////////////////////////////////////////////////////////////////////
# files for debugger
#/////////////////////////////////////////////////////////////////////////////
*.sln
*.csproj
*.pidb
*.unityproj
*.suo
#/////////////////////////////////////////////////////////////////////////////
# OS generated files
#/////////////////////////////////////////////////////////////////////////////
.DS_Store
ehthumbs.db
Thumbs.db
#/////////////////////////////////////////////////////////////////////////////
# WebStorm files
#/////////////////////////////////////////////////////////////////////////////
.idea/
#//////////////////////////
# VS Code files
#//////////////////////////
.vscode/
{
"ver": "1.1.3",
"uuid": "a47f1719-3f8d-4489-bd29-457071b0a786",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "Coin",
"_objFlags": 0,
"_native": "",
"_duration": 0.5166666666666667,
"sample": 60,
"speed": 0.8,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "232db7a5-ef68-4105-b475-9888d4fa58b1"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "e79e0662-0c47-4880-9011-42ade4d32a9c"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "d0cc6bb1-84e1-4041-bc76-840da99bdb22"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "75ec638a-d59e-4097-8a9f-9f76b3aa65e0"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "f217b7e8-76bc-4267-8320-ce9f1ad0468e"
}
},
{
"frame": 0.4166666666666667,
"value": {
"__uuid__": "448c5bc3-a6e0-4044-b8b9-f4ba05742061"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "9e35d743-803c-4093-aa1a-22b18119f11b"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "3efd9501-452e-433e-8dd2-e1ce2b972e7e",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "Die",
"_objFlags": 0,
"_native": "",
"_duration": 0.016666666666666666,
"sample": 60,
"speed": 1,
"wrapMode": 1,
"curveData": {
"paths": {
"Image": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "756bb055-3f56-4631-ab28-f23f6a2a13fb"
}
}
]
}
}
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "ffd7012a-9c29-4ac1-aef1-9324d21f252b",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "Expotion",
"_objFlags": 0,
"_native": "",
"_duration": 0.7666666666666667,
"sample": 60,
"speed": 2,
"wrapMode": 1,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "ca80ae98-7d24-4427-a6f7-118527e9e951"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "443a4fc1-d062-4274-8edf-2bc5b36ce79c"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "e15c7ba0-0419-4cbc-be1e-70ed6041144c"
}
},
{
"frame": 0.75,
"value": null
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "96938458-880b-488e-a4ea-334524dd181b",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "PlayerRedRun",
"_objFlags": 0,
"_native": "",
"_duration": 0.18333333333333332,
"sample": 60,
"speed": 0.8,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "f62e9e3c-d9c8-468b-9bac-e8b6ff3e32a6"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "41f8bcae-d514-40f7-8e8c-72acee91e241"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "01511860-9909-450c-b9f8-46793aade026"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "c613131b-fd8c-4df6-9b96-7ef8c6fc53ca",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "PlayerRun",
"_objFlags": 0,
"_native": "",
"_duration": 0.18333333333333332,
"sample": 60,
"speed": 0.8,
"wrapMode": 2,
"curveData": {
"paths": {
"Image": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "756bb055-3f56-4631-ab28-f23f6a2a13fb"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "602ed256-81a9-434e-b8f2-42cd3f11b18d"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "179efb66-d5fc-4a28-bbc2-c78550816aea"
}
}
]
}
}
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "47a24822-5130-43d7-a075-9a7c910c57a8",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "TapToStart",
"_objFlags": 0,
"_native": "",
"_duration": 0.3333333333333333,
"sample": 60,
"speed": 0.3,
"wrapMode": 2,
"curveData": {
"props": {
"opacity": [
{
"frame": 0,
"value": 200
},
{
"frame": 0.16666666666666666,
"value": 30
},
{
"frame": 0.3333333333333333,
"value": 200
}
]
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "bcbf0dfa-5864-4fc1-991a-66ba19049982",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "Tutorial",
"_objFlags": 0,
"_native": "",
"_duration": 0.5,
"sample": 60,
"speed": 0.6,
"wrapMode": 2,
"curveData": {
"props": {
"x": [
{
"frame": 0,
"value": -62.225
},
{
"frame": 0.25,
"value": -28.284
},
{
"frame": 0.5,
"value": -62.225
}
],
"y": [
{
"frame": 0,
"value": -667.358
},
{
"frame": 0.25,
"value": -636.245
},
{
"frame": 0.5,
"value": -667.358
}
]
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "6e52d4ea-3cda-4300-820d-de3d4be15862",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "TxtAction",
"_objFlags": 0,
"_native": "",
"_duration": 0.5,
"sample": 60,
"speed": 0.3,
"wrapMode": 2,
"curveData": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec3",
"x": 1.2,
"y": 1.2,
"z": 1
}
},
{
"frame": 0.25,
"value": {
"__type__": "cc.Vec3",
"x": 1.3,
"y": 1.3,
"z": 1
}
},
{
"frame": 0.5,
"value": {
"__type__": "cc.Vec3",
"x": 1.2,
"y": 1.2,
"z": 1
}
}
]
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "68a7a84b-afa4-4d12-b9a7-fbf6fdab30f5",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "TxtNinja",
"_objFlags": 0,
"_native": "",
"_duration": 0.5,
"sample": 60,
"speed": 0.3,
"wrapMode": 2,
"curveData": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec3",
"x": 1.2,
"y": 1.2,
"z": 1
}
},
{
"frame": 0.25,
"value": {
"__type__": "cc.Vec3",
"x": 1.3,
"y": 1.3,
"z": 1
}
},
{
"frame": 0.5,
"value": {
"__type__": "cc.Vec3",
"x": 1.2,
"y": 1.2,
"z": 1
}
}
]
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.2",
"uuid": "4c69d71c-7180-4e05-a0ba-0df854beff77",
"importer": "animation-clip",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.3",
"uuid": "e92b809e-9cc3-4331-994b-756ee8e4022f",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "2f3382aa-3b40-403d-acd7-8d1d1b26f516",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 0.4,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "ebd54c86-d5a9-4c17-871e-bd7d08fc93fd",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 0.2139,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "7522f531-a0fa-42c8-a989-012957404edf",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 0.388073,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "991229f0-3aca-4fbf-b3b1-a6b7f9f59c3e",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 66.436825,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "6395292d-ce0f-431c-8bb1-5fa98f027f0b",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 1.069365,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "0a5dd0a0-d9f0-4e71-99ba-f7ce167adae6",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 1.2,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "017f5800-4f11-49fe-b9b9-34fcb5b91a7f",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 0.164694,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "c4839c1d-6367-4192-83bd-62d6ba1360c3",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 0.188526,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.3",
"uuid": "74390146-2ad5-4d98-b918-a2cc62edfa76",
"importer": "audio-clip",
"downloadMode": 0,
"duration": 0.801474,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.3",
"uuid": "26bba328-186c-4a59-897f-c1e398616627",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "Particle",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
}
],
"_prefab": {
"__id__": 3
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-541.526,
69.686,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.ParticleSystem",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 1,
"_custom": true,
"_file": {
"__uuid__": "b2687ac4-099e-403c-a192-ff477686f4f5"
},
"_spriteFrame": {
"__uuid__": "e7aba14b-f956-4480-b254-8d57832e273f"
},
"_texture": null,
"_stopped": false,
"playOnLoad": true,
"autoRemoveOnFinish": false,
"totalParticles": 200,
"duration": -1,
"emissionRate": 50,
"life": 0.20000000298023224,
"lifeVar": 0.5,
"_startColor": {
"__type__": "cc.Color",
"r": 42,
"g": 42,
"b": 42,
"a": 255
},
"_startColorVar": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_endColor": {
"__type__": "cc.Color",
"r": 111,
"g": 111,
"b": 111,
"a": 255
},
"_endColorVar": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"angle": 360,
"angleVar": 360,
"startSize": 49,
"startSizeVar": 10,
"endSize": 10,
"endSizeVar": 0,
"startSpin": 0,
"startSpinVar": 0,
"endSpin": 0,
"endSpinVar": 0,
"sourcePos": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"posVar": {
"__type__": "cc.Vec2",
"x": 7,
"y": 7
},
"_positionType": 0,
"positionType": 0,
"emitterMode": 0,
"gravity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.8600000143051147
},
"speed": 0,
"speedVar": 190.7899932861328,
"tangentialAccel": 0,
"tangentialAccelVar": 0,
"radialAccel": -671.0499877929688,
"radialAccelVar": 65.79000091552734,
"rotationIsDir": false,
"startRadius": 0,
"startRadiusVar": 0,
"endRadius": 0,
"endRadiusVar": 0,
"rotatePerS": 0,
"rotatePerSVar": 0,
"_N$preview": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.3.2",
"uuid": "4e3a9944-3060-4970-b614-8bc4f09a8c05",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.3",
"uuid": "0ad6ce0a-d9ba-49de-bdc0-3be73e0d9a32",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.3.2",
"uuid": "c5f6a27b-74cb-4424-bc53-35f8ad02145d",
"importer": "scene",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.3.2",
"uuid": "90aaafc7-6dde-4c71-b42e-5a3df2887015",
"importer": "scene",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.3",
"uuid": "06847948-7f35-4e9b-8cb3-6f143327cd25",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property([cc.PolygonCollider])
listCollider: cc.PolygonCollider[] = [];
@property(cc.PhysicsPolygonCollider)
listPhysicCollider: cc.PhysicsPolygonCollider[] = [];
@property
isPhysic: boolean = false;
start() {
if (this.isPhysic) {
for (let index = 0; index < this.listCollider.length; index++) {
this.listPhysicCollider[index].offset = this.listCollider[index].offset;
this.listPhysicCollider[index].points.length = this.listCollider[index].points.length;
this.listPhysicCollider[index].points = this.listCollider[index].points;
}
} else {
for (let index = 0; index < this.listPhysicCollider.length; index++) {
this.listCollider[index].offset = this.listPhysicCollider[index].offset;
this.listCollider[index].points.length = this.listPhysicCollider[index].points.length;
this.listCollider[index].points = this.listPhysicCollider[index].points;
}
}
}
}
{
"ver": "1.1.0",
"uuid": "0806bf5b-e6ae-4993-9b98-c5bd968990f3",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import { STATUS_GAME } from "./StatusGame";
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property
isRight: boolean = true;
@property
end: number = 650;
@property
startCloud: number = -650;
protected update(dt: number): void {
if (this.isRight) {
this.node.x += 40 * dt;
if (this.node.x > this.end) {
this.node.position = cc.v3(this.startCloud, this.node.y);
}
}else{
this.node.x -= 40 * dt;
if (this.node.x < this.end) {
this.node.position = cc.v3(this.startCloud, this.node.y);
}
}
}
}
{
"ver": "1.1.0",
"uuid": "b044798c-2edd-4b38-ac61-525aa162fe07",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import SoundsManager from "./SoundManager";
const {ccclass, property} = cc._decorator;
@ccclass
export default class Coin extends cc.Component {
onCollisionEnter(other: cc.Collider, self: cc.Collider) {
if (other.node.name == "BoxCoin") {
GameManager.instance.updateScore();
this.node.active = false;
SoundsManager.Instance.playCoinSound();
this.scheduleOnce(()=>{
this.node.parent.children.forEach((child)=>{
if (child) {
}
child.getComponent(cc.Animation).play();
})
this.node.active = true;
}, 1);
}
}
update(){
}
}
{
"ver": "1.1.0",
"uuid": "329ed01c-7131-4606-b5bf-6541ae45bcb2",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export const GAME_NAME: string = "NinjaAction";
export const HIGH_SCORE: string = "HighScore";
export const MUSIC: string = "Music";
export const RELOAD: string = "Reload";
{
"ver": "1.1.0",
"uuid": "008f2b09-a5f6-482d-92f4-60d9dd58f878",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import Player from "./Player";
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property
isStart: boolean= false;
@property(cc.Vec3)
startEnemy: cc.Vec3 = null;
@property
endEnemy: number = -2000;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
this.node.getComponent(cc.Sprite).enabled = false;
}
update (dt) {
if (this.isStart) {
this.node.position = cc.v3(this.node.position.x, this.node.position.y - (800 * dt));
if (this.node.y < this.endEnemy) {
this.isStart = false;
this.node.position = this.startEnemy;
this.node.getComponent(cc.Sprite).enabled = false;
}
}
}
onCollisionEnter(other, self) {
if (!this.isStart && other.node.name == "BoxGround") {
this.node.getComponent(cc.Sprite).enabled = true;
this.isStart = true;
}else if(this.isStart && other.node.name == "BoxGround"){
other.node.parent.getComponent(Player).onDie();
}
}
}
{
"ver": "1.1.0",
"uuid": "ac5155d0-7612-4c8b-8b0c-2d45363ae20e",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { STATUS_GAME } from './StatusGame';
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import Player from "./Player";
import UIManager from './UIManager';
import SoundsManager from './SoundManager';
import LocalStorage from './LocalStorage';
import MapManager from './MapManager';
const { ccclass, property } = cc._decorator;
@ccclass
export default class GameManager extends cc.Component {
@property(Player)
player: Player = null;
statusGame: number = STATUS_GAME.NONE;
speed: number = 750;
score: number = 0;
speedCount: number = 0;
static instance: GameManager = null;
onLoad(): void {
// 900 //950
GameManager.instance = this;
let manager = cc.director.getCollisionManager();
manager.enabled = true;
// manager.enabledDebugDraw = true;
// manager.enabledDrawBoundingBox = true;
cc.director.getPhysicsManager().enabled = true;
cc.director.getPhysicsManager().gravity = cc.v2(-600, 0);
this.node.on(cc.Node.EventType.TOUCH_END, this.onClickJump, this);
this.statusGame = STATUS_GAME.NONE;
}
protected start(): void {
}
startGame() {
GameManager.instance.statusGame = STATUS_GAME.PLAY;
this.schedule(this.updateTimer, 1);
}
updateTimer() {
this.speedCount++;
this.score++;
UIManager.instance.updateScore(this.score);
if (this.speed <= 900) {
this.speed = this.speed + this.speedCount;
}
}
updateScore() {
this.score++;
UIManager.instance.updateScore(this.score);
}
protected update(dt: number): void {
}
onClickJump() {
this.player.onJump();
}
changeStatusGame(status: number) {
this.statusGame = status;
}
endGame() {
this.saveScore();
this.unscheduleAllCallbacks();
UIManager.instance.disUIGamePlay();
SoundsManager.Instance.pauseMusicSound();
SoundsManager.Instance.playScremSound();
this.scheduleOnce(() => {
SoundsManager.Instance.playWaterSplashSound();
}, 1);
UIManager.instance.activePopupGameOver(true);
}
saveScore() {
if (LocalStorage.getHighScore() < this.score) {
LocalStorage.setHighScore(this.score);
}
}
protected onDestroy(): void {
}
}
{
"ver": "1.1.0",
"uuid": "38f72287-cb53-45d4-af9a-d5425b392d03",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Label)
label: cc.Label = null;
@property
text: string = 'hello';
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
}
// update (dt) {}
}
{
"ver": "1.1.0",
"uuid": "d2ebbd47-9d4a-4236-bbd1-b890cb7c3150",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import ListCoin from "./ListCoin";
import MapManager from "./MapManager";
import { STATUS_GAME } from "./StatusGame";
const { ccclass, property } = cc._decorator;
@ccclass
export default class ItemMap extends cc.Component {
@property()
isMove: boolean = false;
@property
posEnd: number = 0;
@property
posRadomMap: number = 0;
@property
posStartMap: number = 0;
@property
posNextMap: number = 0;
@property
isNextMap: boolean = true;
start() {
//750
//900
}
update(dt) {
if (GameManager.instance.statusGame == STATUS_GAME.PLAY) {
if (this.isMove) {
this.node.y -= GameManager.instance.speed * dt;
}
if (this.node.position.y <= this.posRadomMap && this.isNextMap) {
MapManager.instance.loadMap();
this.isNextMap = false;
}
if (this.node.active && this.node.position.y < this.posEnd) {
this.isMove = false;
this.node.active = false;
this.node.position = cc.v3(0, 2000);
this.isNextMap = true;
}
}
}
setPosMap(isStart: boolean) {
if (isStart) {
this.node.position = cc.v3(0, this.posStartMap);
} else {
this.node.position = cc.v3(0, this.posNextMap);
}
}
}
{
"ver": "1.1.0",
"uuid": "1de0c956-4277-4dd6-a609-e133eb68dfd8",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class ListCoin extends cc.Component {
}
{
"ver": "1.1.0",
"uuid": "82c8d52d-4632-484e-aa49-ea9312a904b1",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { GAME_NAME, HIGH_SCORE, MUSIC, RELOAD } from "./Constans";
const { ccclass, property } = cc._decorator;
@ccclass
export default class LocalStorage extends cc.Component {
public static setHighScore(value: number) {
cc.sys.localStorage.setItem(GAME_NAME + '-' + HIGH_SCORE, value);
}
public static setMusic(value: boolean) {
cc.sys.localStorage.setItem(GAME_NAME + '-' + MUSIC, value);
}
public static getHighScore(): number {
if (cc.sys.localStorage.getItem(GAME_NAME + '-' + HIGH_SCORE) == null) {
cc.sys.localStorage.setItem(GAME_NAME + '-' + HIGH_SCORE, 0);
return 0;
} else return JSON.parse(cc.sys.localStorage.getItem(GAME_NAME + '-' + HIGH_SCORE));
}
public static getMusic(): boolean {
if (cc.sys.localStorage.getItem((GAME_NAME + '-' + MUSIC)) == null) {
cc.sys.localStorage.setItem(GAME_NAME + '-' + MUSIC, true);
return true;
} else return JSON.parse(cc.sys.localStorage.getItem(GAME_NAME + '-' + MUSIC));
}
}
{
"ver": "1.1.0",
"uuid": "12df89b8-4438-494e-b96f-efdba1440f14",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import ItemMap from "./ItemMap";
import StartPlatform from "./StartPlatform";
import { STATUS_GAME } from "./StatusGame";
const { ccclass, property } = cc._decorator;
@ccclass
export default class MapManager extends cc.Component {
@property([cc.Node])
listMap: cc.Node[] = [];
@property
mapIndex: number = 0;
@property(StartPlatform)
startPlatfom: StartPlatform = null;
static instance: MapManager = null;
onLoad() {
MapManager.instance = this;
}
protected start(): void {
//this.mapIndex = Math.floor(Math.random() * 3);
this.mapIndex = 0;
this.listMap[this.mapIndex].getComponent(ItemMap).setPosMap(true);
this.listMap[this.mapIndex].active = true;
this.listMap[this.mapIndex].getComponent(ItemMap).isMove = true;
}
update(dt: number) {
}
loadMap() {
if (this.mapIndex < 3) {
this.mapIndex = 3
let itemMap = this.listMap[this.mapIndex].getComponent(ItemMap);
itemMap.setPosMap(false);
this.listMap[this.mapIndex].active = true;
itemMap.isMove = true;
return;
}else if(this.mapIndex >= 3 && this.mapIndex < 9){
this.mapIndex = this.mapIndex + 1;
let itemMap = this.listMap[this.mapIndex].getComponent(ItemMap);
itemMap.setPosMap(false);
this.listMap[this.mapIndex].active = true;
itemMap.isMove = true;
}else if(this.mapIndex == 9){
this.mapIndex = 0;
let itemMap = this.listMap[this.mapIndex].getComponent(ItemMap);
itemMap.setPosMap(false);
this.listMap[this.mapIndex].active = true;
itemMap.isMove = true;
}
}
}
{
"ver": "1.1.0",
"uuid": "635a0baa-1607-4ed8-86b2-a75701ce40f0",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { STATUS_GAME } from './StatusGame';
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import SoundsManager from './SoundManager';
const { ccclass, property } = cc._decorator;
@ccclass("Player")
export default class Player extends cc.Component {
@property(cc.RigidBody)
rb: cc.RigidBody = null;
@property(cc.Animation)
ani: cc.Animation = null;
@property(cc.Animation)
aniExp: cc.Animation = null;
@property(cc.ParticleSystem)
particleRun: cc.ParticleSystem = null;
isGround: boolean = true;
onLoad(): void {
this.rb = this.getComponent(cc.RigidBody);
this.ani = this.getComponent(cc.Animation);
}
protected start(): void {
}
protected update(dt: number): void {
if (GameManager.instance.statusGame == STATUS_GAME.START) {
this.node.position = new cc.Vec3(this.node.position.x, this.node.position.y + (295 * dt))
}
}
onJump() {
if (GameManager.instance.statusGame == STATUS_GAME.PLAY || GameManager.instance.statusGame == STATUS_GAME.START) {
if (!this.isGround) {
return;
}
this.particleRun.emissionRate = 0;
if (this.rb.gravityScale < 0) {
this.rb.gravityScale = 5;
this.node.scaleX = 1;
this.node.rotation = 90;
} else if (this.rb.gravityScale > 0) {
this.rb.gravityScale = -5;
this.node.scaleX = -1;
this.node.rotation = -90;
}
SoundsManager.Instance.playJumpSound();
this.isGround = false;
}
}
onDie() {
this.aniExp.play();
this.particleRun.emissionRate = 0;
cc.director.getPhysicsManager().gravity = cc.v2(0, 900);
this.rb.gravityScale = -8;
GameManager.instance.changeStatusGame(STATUS_GAME.OVER);
this.rb.fixedRotation = false;
if (this.node.rotation == 90) {
this.rb.angularVelocity = 600;
} else {
this.rb.angularVelocity = -600;
}
this.ani.play("Die");
GameManager.instance.endGame();
}
}
{
"ver": "1.1.0",
"uuid": "53b53484-369f-422e-af95-9d8ed294a3a4",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class SoundsManager extends cc.Component {
public static Instance: SoundsManager = null;
@property(cc.AudioSource)
uiAudio : cc.AudioSource = null;
@property(cc.AudioSource)
gamePlayAudio : cc.AudioSource = null;
@property(cc.AudioSource)
coinAudio : cc.AudioSource = null;
@property(cc.AudioSource)
musicGameAudio : cc.AudioSource = null;
@property([cc.AudioClip])
audioClips : cc.AudioClip[] = [];
onLoad () {
SoundsManager.Instance = this;
}
playUIButtonClickSound()
{
this.uiAudio.clip = this.audioClips[0];
this.uiAudio.play();
}
playSoundSlowSwip(){
this.uiAudio.clip = this.audioClips[1];
this.uiAudio.play();
}
playSoundHit(){
this.uiAudio.clip = this.audioClips[2];
this.uiAudio.play();
}
playMusic()
{
this.musicGameAudio.clip = this.audioClips[3];
this.musicGameAudio.play();
}
playScremSound()
{
this.gamePlayAudio.clip = this.audioClips[4];
this.gamePlayAudio.play();
}
pauseMusicSound(){
this.musicGameAudio.pause();
}
playWaterSplashSound()
{
this.gamePlayAudio.clip = this.audioClips[5];
this.gamePlayAudio.play();
}
playJumpSound()
{
this.gamePlayAudio.clip = this.audioClips[6];
this.gamePlayAudio.play();
}
playCoinSound()
{
this.coinAudio.clip = this.audioClips[7];
this.coinAudio.play();
}
soundOn()
{
this.musicGameAudio.mute = false;
this.uiAudio.mute = false;
this.gamePlayAudio.mute = false;
this.coinAudio.mute = false;
}
soundOff()
{
this.musicGameAudio.mute = true;
this.uiAudio.mute = true;
this.gamePlayAudio.mute = true;
this.coinAudio.mute = true;
}
}
{
"ver": "1.1.0",
"uuid": "9bd2470c-6e96-40a2-beb3-4cd377533590",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import LocalStorage from "./LocalStorage";
import SoundsManager from "./SoundManager";
import UIManager from "./UIManager";
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Node)
platformTop: cc.Node = null;
@property(cc.Node)
platformBottom: cc.Node = null;
@property(cc.Node)
ninjaTop: cc.Node = null;
@property(cc.Node)
ninjaBottom: cc.Node = null;
@property(cc.Node)
txtNinja: cc.Node = null;
@property(cc.Node)
txtAction: cc.Node = null;
@property(cc.Node)
btnSound: cc.Node = null;
@property(cc.Node)
tapToPlay: cc.Node = null;
@property(cc.Node)
tap: cc.Node = null;
@property(cc.SpriteFrame)
imgSoundMute: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
imgSound: cc.SpriteFrame = null;
shakeSpeed1: number = 100;
shakeSpeed2: number = 100;
originalPositionBot: cc.Vec3 = new cc.Vec3(0, -561.609);
originalPositionTop: cc.Vec3 = new cc.Vec3(0, 853.843);
shakeDuration: number = 0.2;
isShake: boolean = false;
timer: number = 0;
totalTime = 1.0;
elapsedTime = 0;
isStop: boolean = false;
protected start(): void {
this.timer = this.shakeDuration;
this.tap.on(cc.Node.EventType.TOUCH_END, this.startGame, this);
this.openScreenHome();
this.schedule(() => {
this.isShake = true;
this.timer = this.shakeDuration;
}, 6)
}
openScreenHome() {
SoundsManager.Instance.playSoundSlowSwip();
cc.tween(this.platformTop)
.to(0.15, { position: new cc.Vec3(0, 853.843) }, { easing: "sineOut" })
.call(() => {
SoundsManager.Instance.playSoundSlowSwip();
})
.start();
cc.tween(this.ninjaTop)
.delay(0.3)
.to(0.15, { position: new cc.Vec3(320, 648) }, { easing: "sineOut" })
.call(() => {
SoundsManager.Instance.playSoundSlowSwip();
})
.start();
cc.tween(this.platformBottom)
.delay(0.6)
.to(0.15, { position: new cc.Vec3(0, -561.609) }, { easing: "sineOut" })
.start();
this.scheduleOnce(() => {
SoundsManager.Instance.playSoundHit();
}, 0.9)
cc.tween(this.ninjaBottom)
.delay(0.9)
.to(0.15, { position: new cc.Vec3(-192, -321.796) }, { easing: "sineOut" })
.call(() => {
SoundsManager.Instance.playSoundSlowSwip();
this.isShake = true;
})
.start();
cc.tween(this.txtNinja)
.delay(1.5)
.to(0.2, { position: new cc.Vec3(248, 157.409) }, { easing: "sineOut" })
.call(() => {
this.txtNinja.getComponent(cc.Animation).play();
})
.start();
cc.tween(this.txtAction)
.delay(1.5)
.to(0.2, { position: new cc.Vec3(248, -31.716) }, { easing: "sineOut" })
.call(() => {
SoundsManager.Instance.playSoundSlowSwip();
this.txtAction.getComponent(cc.Animation).play();
})
.start();
cc.tween(this.btnSound)
.delay(1.5)
.to(0.2, { position: new cc.Vec3(474.75, 825.82) }, { easing: "sineOut" })
.start();
cc.tween(this.tapToPlay)
.delay(1.5)
.to(0.2, { opacity: 200 }, { easing: "sineOut" })
.call(() => {
//this.isStop = true;
this.tapToPlay.getComponent(cc.Animation).play();
})
.start();
}
startGame() {
cc.director.loadScene("GamePlay");
}
onClickSound() {
if (LocalStorage.getMusic()) {
LocalStorage.setMusic(false);
this.btnSound.getComponent(cc.Sprite).spriteFrame = this.imgSoundMute;
SoundsManager.Instance.soundOff();
} else {
LocalStorage.setMusic(true);
SoundsManager.Instance.playUIButtonClickSound();
this.btnSound.getComponent(cc.Sprite).spriteFrame = this.imgSound;
SoundsManager.Instance.soundOn();
}
}
startUiSound() {
if (LocalStorage.getMusic()) {
SoundsManager.Instance.soundOn();
this.btnSound.getComponent(cc.Sprite).spriteFrame = this.imgSound;
} else {
SoundsManager.Instance.soundOff();
this.btnSound.getComponent(cc.Sprite).spriteFrame = this.imgSoundMute;
}
}
protected update(dt: number): void {
if (this.isShake) {
this.timer = this.timer - dt;
if (this.timer < 0) {
this.platformBottom.rotation = 0.;
this.platformTop.rotation = 0;
this.isShake = false;
this.timer = this.shakeDuration
}
else {
this.platformBottom.rotation += (Math.random() * (2 - (-2)) + -2) * 5 * 0.1;
this.platformTop.rotation += (Math.random() * (2 - (-2)) + -2) * 5 * 0.1;
}
}
//this.elapsedTime += dt;
// if (this.isStop) {
// return;
// }
// if (this.elapsedTime <= this.totalTime / 3) {
// this.tapToPlay.opacity = Math.floor((this.elapsedTime / (this.totalTime / 3)) * 200);
// } else if (this.elapsedTime > this.totalTime / 3) {
// this.tapToPlay.opacity = 200 - Math.floor(((this.elapsedTime - this.totalTime / 3) / (this.totalTime / 2)) * 200);
// }
// if (this.elapsedTime >= this.totalTime) {
// this.elapsedTime = 0;
// }
}
}
{
"ver": "1.1.0",
"uuid": "6630844d-cf26-4f94-b8f3-b756faa8b165",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import { STATUS_GAME } from "./StatusGame";
const { ccclass, property } = cc._decorator;
@ccclass
export default class StartPlatform extends cc.Component {
@property(cc.Float)
private scrollSpeed: number = 750;
protected start(): void {
}
update(dt: number) {
if (GameManager.instance.statusGame == STATUS_GAME.PLAY) {
this.node.y -= this.scrollSpeed * dt;
if (this.node.y <= -1300) {
this.node.active = false;
}
}
}
}
{
"ver": "1.1.0",
"uuid": "52ea6357-3654-4c97-9076-5f36ad14265a",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
export const STATUS_GAME = cc.Enum({
NONE: 0,
START: 1,
PLAY: 2,
STOP: 3,
OVER: 4
});
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "a2ed5e38-b507-4663-9a24-ef2138c0759f",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import Player from "./Player";
const { ccclass, property } = cc._decorator;
@ccclass
export default class TriggerDie extends cc.Component {
player: Player = null;
start() {
this.player = this.node.parent.getComponent(Player);
}
onCollisionEnter(other, self) {
if(other.node.group == "Ground"){
this.player.onDie();
}else if(other.node.group == "Die"){
this.player.onDie();
}
}
}
{
"ver": "1.1.0",
"uuid": "bdf5684c-089f-4371-b817-5e4776594884",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
import { STATUS_GAME } from './StatusGame';
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import GameManager from "./GameManager";
import Player from "./Player";
import UIManager from './UIManager';
const { ccclass, property } = cc._decorator;
@ccclass
export default class TriggerGound extends cc.Component {
player: Player = null;
start() {
this.player = this.node.parent.getComponent(Player);
}
onCollisionEnter(other: cc.Collider, self: cc.Collider) {
if (other.node.group == "Ground") {
if (GameManager.instance.statusGame == STATUS_GAME.START) {
GameManager.instance.startGame();
UIManager.instance.disableTutorial();
}
this.player.isGround = true;
// this.player.particleRun.node.active = true;
this.player.particleRun.emissionRate = 6;
}
}
onCollisionExit(other: cc.Collider, self: cc.Collider){
if (this.player.isGround && other.node.group == "Ground") {
this.player.isGround = false;
}
}
}
{
"ver": "1.1.0",
"uuid": "a17f870d-79aa-43e7-b98a-6a89d7c8c2c2",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import { showInterstitialAd } from "../adsense-h5g-api/h5_games_ads";
import { InterstitialType } from "../adsense-h5g-api/interstitial_type";
import GameManager from "./GameManager";
import LocalStorage from "./LocalStorage";
import MapManager from "./MapManager";
import SoundsManager from "./SoundManager";
import { STATUS_GAME } from "./StatusGame";
const { ccclass, property } = cc._decorator;
@ccclass
export default class UIManager extends cc.Component {
static instance: UIManager = null;
@property([cc.SpriteFrame])
numberSprites: cc.SpriteFrame[] = [];
@property([cc.Sprite])
count9: cc.Sprite = null;
@property([cc.Sprite])
count99: cc.Sprite = null;
@property([cc.Sprite])
count999: cc.Sprite = null;
@property(cc.Node)
splat: cc.Node = null;
@property(cc.Node)
tutorial: cc.Node = null;
@property(cc.Node)
btnPause: cc.Node = null;
@property(cc.Node)
panlScore: cc.Node = null;
@property(cc.Node)
popPause: cc.Node = null;
@property(cc.Node)
popGameOver: cc.Node = null;
@property([cc.Sprite])
scoreUnitRows: cc.Sprite = null;
@property([cc.Sprite])
scoreDozens: cc.Sprite = null;
@property([cc.Sprite])
scoreHundreds: cc.Sprite = null;
@property([cc.Sprite])
hScoreUnitRows: cc.Sprite = null;
@property([cc.Sprite])
hScoreDozens: cc.Sprite = null;
@property([cc.Sprite])
hScoreHundreds: cc.Sprite = null;
@property(cc.SpriteFrame)
imgSoundMute: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
imgSound: cc.SpriteFrame = null;
@property(cc.Node)
soundGamePlay: cc.Node = null;
isStartGame: boolean = false;
onLoad() {
UIManager.instance = this;
}
start() {
this.startGame();
}
loadUIGame() {
this.count9.spriteFrame = this.numberSprites[0];
this.count99.node.active = false;
this.count999.node.active = false;
this.btnPause.active = true;
this.soundGamePlay.active = true;
this.panlScore.active = true;
this.startUiSound();
}
updateScore(score: number) {
if (score < 10) {
this.count9.spriteFrame = this.numberSprites[score];
}
if (score > 9) {
this.count99.node.active = true;
this.count9.spriteFrame =
this.numberSprites[Math.floor(score / 10)];
this.count99.spriteFrame = this.numberSprites[score % 10];
} else this.count99.node.active = false;
if (score > 99) {
this.count999.node.active = true;
this.count9.spriteFrame =
this.numberSprites[Math.floor(score / 100)];
this.count99.spriteFrame =
this.numberSprites[Math.floor((score % 100) / 10)];
this.count999.spriteFrame = this.numberSprites[score % 10];
} else this.count999.node.active = false;
}
update(dt: number): void {
}
startGame() {
cc.director.resume();
this.loadUIGame();
this.splatActive();
}
reloadGame() {
showInterstitialAd(InterstitialType.START, "StartGame", ()=> {
cc.director.loadScene("GamePlay");
})
}
homeGame() {
cc.director.resume();
showInterstitialAd(InterstitialType.START, "StartGame", ()=> {
cc.director.loadScene("StartGame");
})
}
splatActive() {
this.splat.active = true;
cc.tween(this.splat)
.to(1.3, { opacity: 0 })
.call(() => {
})
.start();
cc.tween(this.tutorial)
.delay(1.3)
.to(0.5, { opacity: 200 })
.call(() => {
this.tutorial.active = true;
this.tutorial.getComponent(cc.Animation).play();
SoundsManager.Instance.playMusic();
GameManager.instance.statusGame = STATUS_GAME.START;
})
.start();
}
disableTutorial() {
this.tutorial.active = false;
}
activePopupGameOver(isActive: boolean) {
this.popGameOver.position = cc.v3(0, 1327.44);
this.popGameOver.active = isActive;
cc.tween(this.popGameOver)
.delay(1.3)
.to(0.5, { position: new cc.Vec3(0, 0) }, { easing: "elasticOut" })
.start();
this.updateScoreGameOver(GameManager.instance.score);
this.updateHightScore(LocalStorage.getHighScore());
}
updateScoreGameOver(score: number) {
if (score < 10) {
this.scoreUnitRows.spriteFrame = this.numberSprites[score];
}
if (score > 9) {
this.scoreDozens.node.active = true;
this.scoreUnitRows.spriteFrame =
this.numberSprites[Math.floor(score / 10)];
this.scoreDozens.spriteFrame = this.numberSprites[score % 10];
} else this.scoreDozens.node.active = false;
if (score > 99) {
this.scoreHundreds.node.active = true;
this.scoreUnitRows.spriteFrame =
this.numberSprites[Math.floor(score / 100)];
this.scoreDozens.spriteFrame =
this.numberSprites[Math.floor((score % 100) / 10)];
this.scoreHundreds.spriteFrame = this.numberSprites[score % 10];
} else this.scoreHundreds.node.active = false;
}
updateHightScore(score: number) {
if (score < 10) {
this.hScoreUnitRows.spriteFrame = this.numberSprites[score];
}
if (score > 9) {
this.hScoreDozens.node.active = true;
this.hScoreUnitRows.spriteFrame =
this.numberSprites[Math.floor(score / 10)];
this.hScoreDozens.spriteFrame = this.numberSprites[score % 10];
} else this.hScoreDozens.node.active = false;
if (score > 99) {
this.hScoreHundreds.node.active = true;
this.hScoreUnitRows.spriteFrame =
this.numberSprites[Math.floor(score / 100)];
this.hScoreDozens.spriteFrame =
this.numberSprites[Math.floor((score % 100) / 10)];
this.hScoreHundreds.spriteFrame = this.numberSprites[score % 10];
} else this.hScoreHundreds.node.active = false;
}
activePopupPause(isActive: boolean) {
this.popPause.active = isActive;
if (isActive) {
cc.director.pause();
} else {
cc.director.resume();
}
}
onClickSound() {
if (LocalStorage.getMusic()) {
LocalStorage.setMusic(false);
this.soundGamePlay.getComponent(cc.Sprite).spriteFrame = this.imgSoundMute;
SoundsManager.Instance.soundOff();
} else {
LocalStorage.setMusic(true);
SoundsManager.Instance.playUIButtonClickSound();
this.soundGamePlay.getComponent(cc.Sprite).spriteFrame = this.imgSound;
SoundsManager.Instance.soundOn();
}
}
startUiSound() {
if (LocalStorage.getMusic()) {
SoundsManager.Instance.soundOn();
this.soundGamePlay.getComponent(cc.Sprite).spriteFrame = this.imgSound;
} else {
SoundsManager.Instance.soundOff();
this.soundGamePlay.getComponent(cc.Sprite).spriteFrame = this.imgSoundMute;
}
}
disUIGamePlay() {
this.node.children[0].active = false;
this.btnPause.active = false;
this.soundGamePlay.active = false;
this.panlScore.active = false;
}
pauseGame() {
this.activePopupPause(true);
}
rePauseGame() {
this.activePopupPause(false);
}
}
{
"ver": "1.1.0",
"uuid": "c97d8624-fa90-4eab-aed4-e40a9b874f2f",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.3",
"uuid": "56ce705d-d7f3-4f3b-8c5c-64a085e06414",
"importer": "folder",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.0.3",
"uuid": "78f298a1-1c98-49c9-93c5-f7669437a83d",
"importer": "asset",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "f3ed8d9c-e85e-4ad9-b142-510a9f5cbb76",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 70,
"platformSettings": {},
"subMetas": {
"0": {
"ver": "1.0.6",
"uuid": "17fc35e4-0a79-4756-9e77-7a63714c13e4",
"importer": "sprite-frame",
"rawTextureUuid": "f3ed8d9c-e85e-4ad9-b142-510a9f5cbb76",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -1,
"trimX": 19,
"trimY": 11,
"width": 32,
"height": 50,
"rawWidth": 70,
"rawHeight": 70,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.7",
"uuid": "ad83f509-e60d-4371-8325-a2e8f0cefc4d",
"importer": "texture",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 70,
"platformSettings": {},
"subMetas": {
"1": {
"ver": "1.0.6",
"uuid": "3b864816-7f4c-4393-9d59-b7d6eb5c79ba",
"importer": "sprite-frame",
"rawTextureUuid": "ad83f509-e60d-4371-8325-a2e8f0cefc4d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -1,
"trimX": 25,
"trimY": 11,
"width": 20,
"height": 50,
"rawWidth": 70,
"rawHeight": 70,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment