Commit 0b7ce095 authored by Nguyễn Quang Sáng's avatar Nguyễn Quang Sáng

update 27/7

parent 2ce43f74
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "New 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": [
3.754,
0,
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": 775,
"_dstBlendFactor": 772,
"_custom": true,
"_file": {
"__uuid__": "b2687ac4-099e-403c-a192-ff477686f4f5"
},
"_spriteFrame": {
"__uuid__": "8d2a9861-057e-44ec-a6b1-16c6d47f8dd2"
},
"_texture": null,
"_stopped": true,
"playOnLoad": true,
"autoRemoveOnFinish": true,
"totalParticles": 650,
"duration": 2.5,
"emissionRate": 550,
"life": 3,
"lifeVar": 0.5,
"_startColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"a": 255
},
"_startColorVar": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 0
},
"_endColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 0
},
"_endColorVar": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 0
},
"angle": 0,
"angleVar": 360,
"startSize": 200,
"startSizeVar": 50,
"endSize": 200,
"endSizeVar": 0,
"startSpin": 0,
"startSpinVar": 360,
"endSpin": 0,
"endSpinVar": 0,
"sourcePos": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"posVar": {
"__type__": "cc.Vec2",
"x": 240,
"y": 240
},
"_positionType": 1,
"positionType": 1,
"emitterMode": 0,
"gravity": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"speed": 50,
"speedVar": 0,
"tangentialAccel": 0,
"tangentialAccelVar": 360,
"radialAccel": 350,
"radialAccelVar": 200,
"rotationIsDir": true,
"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": "3baee33d-6796-4280-8864-4a5ae4291f32",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 162, "width": 160,
"height": 82 "height": 82
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
200.517, 200.517,
282.219, 282.21900000000005,
0, 0,
0, 0,
0, 0,
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
"__uuid__": "4c985699-20b6-4953-9b67-f5901c523cc2" "__uuid__": "4c985699-20b6-4953-9b67-f5901c523cc2"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
"__uuid__": "5e0960c8-7576-43ff-9cb5-ed46d0378ead" "__uuid__": "5e0960c8-7576-43ff-9cb5-ed46d0378ead"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
"__uuid__": "b7503491-55cf-49fc-8501-7ca7cc3ae1a9" "__uuid__": "b7503491-55cf-49fc-8501-7ca7cc3ae1a9"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 242, "width": 240,
"height": 82 "height": 82
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
"__uuid__": "ff89843c-3301-41f3-afcc-901b3c9df86c" "__uuid__": "ff89843c-3301-41f3-afcc-901b3c9df86c"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 0,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
......
This diff is collapsed.
This diff is collapsed.
...@@ -75,22 +75,19 @@ ...@@ -75,22 +75,19 @@
"__id__": 5 "__id__": 5
}, },
{ {
"__id__": 7 "__id__": 8
}, },
{ {
"__id__": 10 "__id__": 11
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 13 "__id__": 15
},
{
"__id__": 14
}, },
{ {
"__id__": 15 "__id__": 16
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -251,6 +248,9 @@ ...@@ -251,6 +248,9 @@
"_components": [ "_components": [
{ {
"__id__": 6 "__id__": 6
},
{
"__id__": 7
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -333,6 +333,19 @@ ...@@ -333,6 +333,19 @@
"_atlas": null, "_atlas": null,
"_id": "a8n4d+a8FOE7Ybhwd7byeC" "_id": "a8n4d+a8FOE7Ybhwd7byeC"
}, },
{
"__type__": "a6db5wfXWRGH4RmRsOfJHj1",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"introSound": {
"__uuid__": "fa86100b-1011-4065-ba50-1914d84fcbac"
},
"_id": "3f/ULYa1lFvYRIpNeNvkYJ"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Title", "_name": "Title",
...@@ -344,10 +357,10 @@ ...@@ -344,10 +357,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 8 "__id__": 9
}, },
{ {
"__id__": 9 "__id__": 10
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -403,7 +416,7 @@ ...@@ -403,7 +416,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -435,7 +448,7 @@ ...@@ -435,7 +448,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 7 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"_defaultClip": { "_defaultClip": {
...@@ -460,7 +473,10 @@ ...@@ -460,7 +473,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 11 "__id__": 12
},
{
"__id__": 14
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -516,7 +532,7 @@ ...@@ -516,7 +532,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 10 "__id__": 11
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -525,7 +541,7 @@ ...@@ -525,7 +541,7 @@
"zoomScale": 1.2, "zoomScale": 1.2,
"clickEvents": [ "clickEvents": [
{ {
"__id__": 12 "__id__": 13
} }
], ],
"_N$interactable": true, "_N$interactable": true,
...@@ -598,13 +614,25 @@ ...@@ -598,13 +614,25 @@
{ {
"__type__": "cc.ClickEvent", "__type__": "cc.ClickEvent",
"target": { "target": {
"__id__": 2 "__id__": 11
}, },
"component": "", "component": "",
"_componentId": "0630eLWyFxBW47AT1b77FBE", "_componentId": "4bc11amZLhJF7l5YKzcrMTW",
"handler": "LoadScene", "handler": "LoadScene0",
"customEventData": "" "customEventData": ""
}, },
{
"__type__": "4bc11amZLhJF7l5YKzcrMTW",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"volumeOnSprite": null,
"volumeOffSprite": null,
"_id": "74+UhfoGhAqI0uYMFlviH3"
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",
...@@ -648,15 +676,5 @@ ...@@ -648,15 +676,5 @@
"_originalWidth": 0, "_originalWidth": 0,
"_originalHeight": 0, "_originalHeight": 0,
"_id": "336r9sBylMMIN9QPWVS9fO" "_id": "336r9sBylMMIN9QPWVS9fO"
},
{
"__type__": "0630eLWyFxBW47AT1b77FBE",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "47EM7ryghJM7bCKUvHjJ6n"
} }
] ]
\ No newline at end of file
import GamePlay from "./GamePlay"; import GamePlay from "./GamePlay";
import Levels from "./Levels";
const { ccclass, property } = cc._decorator; const { ccclass, property } = cc._decorator;
...@@ -13,40 +12,66 @@ export default class Block extends cc.Component { ...@@ -13,40 +12,66 @@ export default class Block extends cc.Component {
lockUp = false; lockUp = false;
lockDown = false; lockDown = false;
lockLeftX = null;
lockRightX = null;
lockUpY = null;
lockDownY = null;
onCollisionEnter(other, self) { onCollisionEnter(other, self) {
if (GamePlay.instance.currentHoldingBlock != this.node) return;
if (other.tag == 1) { if (other.tag == 1) {
console.log("next level!"); GamePlay.instance.onCompleteLevel();
GamePlay.instance.onMouseLeave();
GamePlay.instance.onMouseUp();
Levels.instance.currentLevel += 1;
Levels.instance.LoadScene(null, Levels.instance.currentLevel.toString());
} else { } else {
GamePlay.instance.isOnBlockCollision = true;
GamePlay.instance.touchLocOnBlockCollision =
GamePlay.instance.currentTouchLoc;
this.isColliding = true; this.isColliding = true;
if (GamePlay.instance.touchDelta.y > 0) {
this.lockUp = true; let nodeA = this.node;
this.lockDown = false; let nodeB: cc.Node = other.node;
}
if (GamePlay.instance.touchDelta.y < 0) { if (this.typeMove == 2) {
this.lockDown = true; if (nodeA.position.x - nodeB.position.x < 0) {
this.lockUp = false; let pos = nodeA.position;
} pos.x =
if (GamePlay.instance.touchDelta.x > 0) { nodeB.x -
nodeB.getContentSize().width / 2 -
nodeA.getContentSize().width / 2;
nodeA.position = pos;
this.lockRight = true; this.lockRight = true;
this.lockLeft = false; this.lockRightX = GamePlay.instance.currentTouchLoc.x;
} } else {
if (GamePlay.instance.touchDelta.x < 0) { let pos = nodeA.position;
this.lockRight = false; pos.x =
nodeB.x +
nodeB.getContentSize().width / 2 +
nodeA.getContentSize().width / 2;
nodeA.position = pos;
this.lockLeft = true; this.lockLeft = true;
this.lockLeftX = GamePlay.instance.currentTouchLoc.x;
}
} else {
if (nodeA.position.y - nodeB.position.y < 0) {
let pos = nodeA.position;
pos.y =
nodeB.y -
nodeB.getContentSize().height / 2 -
nodeA.getContentSize().height / 2;
nodeA.position = pos;
this.lockUp = true;
this.lockUpY = GamePlay.instance.currentTouchLoc.y;
} else {
let pos = nodeA.position;
pos.y =
nodeB.y +
nodeB.getContentSize().height / 2 +
nodeA.getContentSize().height / 2;
nodeA.position = pos;
this.lockDown = true;
this.lockDownY = GamePlay.instance.currentTouchLoc.y;
} }
} }
} }
onCollisionExit() {
this.isColliding = false;
this.lockLeft = false;
this.lockRight = false;
this.lockUp = false;
this.lockDown = false;
} }
} }
{ {
"ver": "1.1.0", "ver": "1.1.0",
"uuid": "ff77d565-e394-4084-8f35-1f46fb11df82", "uuid": "4bc116a6-64b8-4917-b979-60acdcacc4d6",
"importer": "typescript", "importer": "typescript",
"isPlugin": false, "isPlugin": false,
"loadPluginInWeb": true, "loadPluginInWeb": true,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{
"ver": "1.1.0",
"uuid": "221106aa-8b17-43c7-8b83-4e85180e840e",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.1.0",
"uuid": "e6cbe195-8f8c-4f15-9d28-37d5bd7cc241",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"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.
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