Commit 0fd3e414 authored by 李维's avatar 李维

dev commit

parent 97f694ef
{
"ver": "1.1.2",
"uuid": "f736e357-3c20-4e7c-9fe1-77f78f376de0",
"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": "bubble_0",
"_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": 195,
"height": 195
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
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.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "82444753-9e7e-4432-89cb-8d72344d2c44"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "54TnCPh51Nt4I/6fuKOZwD",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.7",
"uuid": "ff427172-05bc-4907-a9d6-859d14218f60",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -90,19 +90,19 @@
"__id__": 20
},
{
"__id__": 30
"__id__": 21
}
],
"_active": true,
"_components": [
{
"__id__": 35
"__id__": 31
},
{
"__id__": 36
"__id__": 32
},
{
"__id__": 37
"__id__": 33
}
],
"_prefab": null,
......@@ -192,7 +192,7 @@
"array": [
0,
0,
412.2280922013928,
268.2372326687317,
0,
0,
0,
......@@ -213,7 +213,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "55OBd4kNVC9ZNPXj2q6BO8"
"_id": "a0d1RtnJpFXptbrZO36MEu"
},
{
"__type__": "cc.Camera",
......@@ -249,7 +249,7 @@
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "bakjwEY3xNz6uBY4nto/Gf"
"_id": "adlfgXOqtNg6cHC410rnd8"
},
{
"__type__": "cc.Node",
......@@ -1039,6 +1039,64 @@
"_atlas": null,
"_id": "07xz/l54xOPJlrregfnv2w"
},
{
"__type__": "cc.Node",
"_name": "bubble_group",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
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": "46xoK5kedLqrzwmjoCmiDn"
},
{
"__type__": "cc.Node",
"_name": "res",
......@@ -1048,13 +1106,13 @@
},
"_children": [
{
"__id__": 21
"__id__": 22
},
{
"__id__": 24
"__id__": 25
},
{
"__id__": 27
"__id__": 28
}
],
"_active": false,
......@@ -1112,11 +1170,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 20
"__id__": 21
},
"_children": [
{
"__id__": 22
"__id__": 23
}
],
"_active": true,
......@@ -1174,13 +1232,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 21
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
"__id__": 24
}
],
"_prefab": null,
......@@ -1236,7 +1294,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
"__id__": 23
},
"_enabled": true,
"_materials": [],
......@@ -1268,11 +1326,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 20
"__id__": 21
},
"_children": [
{
"__id__": 25
"__id__": 26
}
],
"_active": true,
......@@ -1330,13 +1388,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 24
"__id__": 25
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 26
"__id__": 27
}
],
"_prefab": null,
......@@ -1392,7 +1450,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
"__id__": 26
},
"_enabled": true,
"_materials": [],
......@@ -1420,11 +1478,11 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 20
"__id__": 21
},
"_children": [
{
"__id__": 28
"__id__": 29
}
],
"_active": true,
......@@ -1482,13 +1540,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 27
"__id__": 28
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 29
"__id__": 30
}
],
"_prefab": null,
......@@ -1544,7 +1602,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 29
},
"_enabled": true,
"_clip": {
......@@ -1557,259 +1615,6 @@
"preload": false,
"_id": "0adN50f61DlbmppsPkOnjX"
},
{
"__type__": "cc.Node",
"_name": "bubble_group",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 31
},
{
"__id__": 33
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
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": "46xoK5kedLqrzwmjoCmiDn"
},
{
"__type__": "cc.Node",
"_name": "bubble_1",
"_objFlags": 0,
"_parent": {
"__id__": 30
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 32
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 189,
"height": 186
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
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": "desslHQPdJlo29poPy5pSe"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 31
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "09ab21ca-576e-4e62-8b62-b936e450892a"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "1d5UrkEstOMIbhPP+Hm98d"
},
{
"__type__": "cc.Node",
"_name": "bubble_2",
"_objFlags": 0,
"_parent": {
"__id__": 30
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 34
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 189,
"height": 186
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
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": "8d0mlm3xVOGIGMK7yel5SO"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "09ab21ca-576e-4e62-8b62-b936e450892a"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "bfzZF8IN9LeZitxOzS0dnn"
},
{
"__type__": "cc.Canvas",
"_name": "",
......@@ -1862,6 +1667,9 @@
"__id__": 2
},
"_enabled": true,
"bubble": {
"__uuid__": "ff427172-05bc-4907-a9d6-859d14218f60"
},
"_id": "e687yyoRBIzZAOVRL8Sseh"
}
]
\ No newline at end of file
......@@ -62,7 +62,8 @@ export default class Cartoon {
}
setCartoonElement(key, node) {
this.elements[key] = node;
this.elements[key] = {};
this.elements[key].node = node;
this.elements[key].node.key = key;
}
......
......@@ -24,6 +24,7 @@ export default class GameLogic {
m_curMiddleAnswerPoi = 0;
m_curRightAnswerPoi = 0;
m_maxScale = 0.7;
constructor(formData, systemOption) {
this.g_systemOption = systemOption;
this.g_imageResList = this.g_systemOption.imageResList;
......@@ -78,30 +79,34 @@ export default class GameLogic {
if(bubble.move.enable && !bubble.move.fix) {
bubble.move.x += bubble.move.vX
bubble.move.y += bubble.move.vY
if(bubble.move.scale<1) {
bubble.move.scale += 0.01;
if(bubble.move.scale<this.m_maxScale) {
bubble.move.scale += 0.1;
} else {
bubble.move.scale = 1
bubble.move.scale = this.m_maxScale
}
bubble.node.scaleX = bubble.move.scale;
bubble.node.scaleY = bubble.move.scale;
if (bubble.move.x >= maxX - bubble.move.r * bubble.move.scale) {
bubble.move.x = maxX - bubble.move.r;
bubble.move.x = maxX - bubble.move.r * bubble.move.scale;
bubble.move.vX = -bubble.move.vX;
bubble.move.lastId = null;
}
if (bubble.move.x <= -maxX + bubble.move.r * bubble.move.scale) {
bubble.move.x = -maxX + bubble.move.r;
bubble.move.x = -maxX + bubble.move.r * bubble.move.scale;
bubble.move.vX = -bubble.move.vX;
bubble.move.lastId = null;
}
if (bubble.move.y >= maxY - bubble.move.r * bubble.move.scale) {
bubble.move.y = maxY - bubble.move.r;
bubble.move.y = maxY - bubble.move.r * bubble.move.scale;
bubble.move.vY = -bubble.move.vY;
bubble.move.lastId = null;
}
if (bubble.move.y <= -maxY + bubble.move.r * bubble.move.scale) {
bubble.move.y = -maxY + bubble.move.r;
bubble.move.y = -maxY + bubble.move.r * bubble.move.scale;
bubble.move.vY = - bubble.move.vY;
bubble.move.lastId = null;
}
bubble.node.x = bubble.move.x
......@@ -115,14 +120,17 @@ export default class GameLogic {
var tempX = this.bubblesAll[index_x].move.vX;
var tempY = this.bubblesAll[index_x].move.vY;
if(this.bubblesAll[j].move.fix) {
this.bubblesAll[index_x].move.vX = -this.bubblesAll[index_x].move.vX;
this.bubblesAll[index_x].move.vY = -this.bubblesAll[index_x].move.vY;
} else {
this.bubblesAll[index_x].move.vX = this.bubblesAll[j].move.vX;
this.bubblesAll[j].move.vX = tempX;
this.bubblesAll[index_x].move.vY = this.bubblesAll[j].move.vY;
this.bubblesAll[j].move.vY = tempY;
if(this.bubblesAll[index_x].move.lastId != this.bubblesAll[j].move.id) {
this.bubblesAll[index_x].move.lastId = this.bubblesAll[j].move.id
if(this.bubblesAll[j].move.fix) {
this.bubblesAll[index_x].move.vX = -this.bubblesAll[index_x].move.vX;
this.bubblesAll[index_x].move.vY = -this.bubblesAll[index_x].move.vY;
} else {
this.bubblesAll[index_x].move.vX = this.bubblesAll[j].move.vX;
this.bubblesAll[j].move.vX = tempX;
this.bubblesAll[index_x].move.vY = this.bubblesAll[j].move.vY;
this.bubblesAll[j].move.vY = tempY;
}
}
}
}
......@@ -130,14 +138,19 @@ export default class GameLogic {
}
})
}, 20)
}, 30)
}
initNodes() {
this.g_cartoon.initCartoonElement("background", this.g_cartoon.getNodeByPath(`Canvas/background/background`));
this.g_cartoon.initCartoonElement("lion", this.g_cartoon.getNodeByPath(`Canvas/lion`));
for(let i=1; i<=7; i++) {
this.g_cartoon.initCartoonElement(`bubble_${i}`, this.g_cartoon.getNodeByPath(`Canvas/bubble_group/bubble_${i}`));
const bubbleParent = this.g_cartoon.getNodeByPath(`Canvas/bubble_group`)
for(let i=0; i<6; i++) {
const bubble = cc.instantiate(this.g_systemOption.prefabs.bubble);
bubble.parent = bubbleParent;
console.log(bubble)
this.g_cartoon.setCartoonElement(`bubble_${i}`, bubble)
}
}
......@@ -153,10 +166,10 @@ export default class GameLogic {
bubblesAll = []
initBubbles() {
for(let i=1; i<=7; i++) {
for(let i=0; i<6; i++) {
const bubble = this.g_cartoon.getCartoonElement(`bubble_${i}`)
bubble.move = {
r: 90, x: 0, y: 0, vX: 1, vY: 1.3, enable: false, fix: false, scale: 0
r: 100, x: 0, y: 0, vX: 1, vY: 1.3, enable: false, fix: false, scale: 0, id: i, lastId: null
}
bubble.node.scaleX = 0;
bubble.node.scaleY = 0;
......@@ -173,14 +186,14 @@ export default class GameLogic {
node.x = -cc.winSize.width / 2 + 100
node.y = -cc.winSize.height / 2 + 100
this.bubblesAll.push({node: node, move: {
r: 50, x: node.x, y: node.y, vX: 0, vY: 0, enable: true, fix: true, scale: 1
r: 50, x: node.x, y: node.y, vX: 0, vY: 0, enable: true, fix: true, scale: 1, id: 999, lastId: null
}})
node = this.g_cartoon.getNodeByPath(`Canvas/btn_back`)
node.x = -cc.winSize.width / 2 + 60
node.y = cc.winSize.height / 2 - 50
this.bubblesAll.push({node: node, move: {
r: 40, x: node.x, y: node.y, vX: 0, vY: 0, enable: true, fix: true, scale: 1
r: 40, x: node.x, y: node.y, vX: 0, vY: 0, enable: true, fix: true, scale: 1, id: 998, lastId: null
}})
node = this.g_cartoon.getNodeByPath(`Canvas/btn_restart`)
......@@ -194,13 +207,20 @@ export default class GameLogic {
node.x = cc.winSize.width / 2 - 150
node.y = -cc.winSize.height / 2 + 170
this.bubblesAll.push({node: node, move: {
r: 90, x: node.x, y: node.y, vX: 0, vY: 0, enable: true, fix: true, scale: 1
r: 90, x: node.x, y: node.y, vX: 0, vY: 0, enable: true, fix: true, scale: 1, id: 997, lastId: null
}})
}
releaseBubbles() {
let startx = cc.winSize.width / 2 - 300
let starty = -cc.winSize.height / 2 + 200
let startx = cc.winSize.width / 2 - 350
let starty = -cc.winSize.height / 2 + 350
const vArr = [
{vX: -5, vY: 1 }, {vX: -5, vY: 2 }, {vX: -5, vY: 1 }
]
// const pos = [
// {x: }
// ]
this.bubblesAll.forEach((bubble, index) => {
setTimeout(() => {
if(!bubble.move.fix) {
......@@ -208,13 +228,17 @@ export default class GameLogic {
bubble.node.y = starty
bubble.move.x = startx
bubble.move.y = starty
bubble.move.vX = -1 * (Math.ceil(Math.random()*10)/10 + 2)
bubble.move.vY = 1 * (Math.ceil(Math.random()*10)/10 + 1.5)
bubble.move.scale = 0.2;
bubble.move.vX = vArr[index%3].vX
bubble.move.vY = vArr[index%3].vY
bubble.move.scale = 0.3;
bubble.node.scaleX = bubble.move.scale;
bubble.node.scaleY = bubble.move.scale;
console.log(bubble.move.vX, bubble.move.vY)
// console.log(bubble.move.vX, bubble.move.vY)
bubble.move.enable = true;
setTimeout(() => {
bubble.move.vX = -1 * (Math.ceil(Math.random()*10)/10)
}, 1000);
}
}, 1500 * index);
})
......
......@@ -12,6 +12,10 @@ cc.Class({
extends: cc.Component,
properties: {
bubble: {
type: cc.Prefab,
default: null,
},
},
gameLogic: null,
......@@ -82,6 +86,9 @@ cc.Class({
imageResList: this._imageResList,
audioResList: this._audioResList,
animaResList: this._animaResList,
prefabs: {
bubble: this.bubble
},
properties: {
option: this.option,
empty: this.empty
......
{
"ver": "2.3.5",
"uuid": "e624a7bc-1fa4-4068-bd1e-97081bb774df",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 262,
"height": 261,
"platformSettings": {},
"subMetas": {
"bubble": {
"ver": "1.0.4",
"uuid": "82444753-9e7e-4432-89cb-8d72344d2c44",
"rawTextureUuid": "e624a7bc-1fa4-4068-bd1e-97081bb774df",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 195,
"height": 195,
"rawWidth": 195,
"rawHeight": 195,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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