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

Move Player

parent 0e663103
......@@ -14,8 +14,8 @@
"frame": 0,
"value": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": 1.3,
"y": 1.3,
"z": 1
}
},
......@@ -23,8 +23,8 @@
"frame": 0.5,
"value": {
"__type__": "cc.Vec3",
"x": 1.07,
"y": 1.07,
"x": 1.37,
"y": 1.37,
"z": 1
}
},
......@@ -32,8 +32,8 @@
"frame": 1,
"value": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": 1.3,
"y": 1.3,
"z": 1
}
}
......
......@@ -14,8 +14,8 @@
"frame": 0,
"value": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": 1.3,
"y": 1.3,
"z": 1
}
},
......@@ -23,8 +23,8 @@
"frame": 0.25,
"value": {
"__type__": "cc.Vec3",
"x": 1.1,
"y": 1.1,
"x": 1.4,
"y": 1.4,
"z": 1
}
},
......@@ -32,8 +32,8 @@
"frame": 0.5,
"value": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": 1.3,
"y": 1.3,
"z": 1
}
}
......
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "Body",
"_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": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
60,
0,
0,
0,
0,
0,
1,
0.5,
0.5,
0.5
]
},
"_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__": "fe595b35-3e31-424e-8cde-85b18a007113"
},
"_type": 0,
"_sizeMode": 0,
"_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": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.3.2",
"uuid": "d0e95eff-3c47-479a-8f7e-893ace0e3ae8",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"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": "Header",
"_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": 50,
"height": 50
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
120,
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__": "8cd13306-8a0c-4085-875c-aad8a1a0d9f9"
},
"_type": 0,
"_sizeMode": 0,
"_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": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.3.2",
"uuid": "739ce2c4-b1b6-44ba-9514-6f352e81795e",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -303,7 +303,7 @@
},
"_enabled": true,
"isStart": true,
"rotateSpeed": 90,
"rotateSpeed": 180,
"holeEnd2": {
"__id__": 5
},
......
......@@ -117,7 +117,7 @@
},
"_enabled": true,
"isStart": true,
"rotateSpeed": 90,
"rotateSpeed": 450,
"_id": ""
},
{
......
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "Tail",
"_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": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
0.5,
0.5,
0.5
]
},
"_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__": "f6b6b60c-7033-45e5-9017-67a3ce6e8831"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.3.2",
"uuid": "1d034ac0-2b54-43b4-bdf2-aeed1112252b",
"importer": "prefab",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -74,8 +74,8 @@
0,
0,
1,
1,
1,
1.3,
1.3,
1
]
},
......
......@@ -58,8 +58,8 @@
0,
0,
1,
1,
1,
1.4,
1.4,
1
]
},
......
......@@ -39,8 +39,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 750,
"height": 1000
"width": 950,
"height": 1250
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -51,7 +51,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
375,
475,
0,
0,
0,
......@@ -86,23 +86,23 @@
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 750,
"height": 1000
"width": 950,
"height": 1250
},
"_resize": 2,
"_N$layoutType": 3,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 228,
"height": 228
"width": 280,
"height": 280
},
"_N$startAxis": 0,
"_N$paddingLeft": 0,
"_N$paddingLeft": 25,
"_N$paddingRight": 0,
"_N$paddingTop": 20,
"_N$paddingBottom": 0,
"_N$spacingX": 32,
"_N$spacingY": 20,
"_N$spacingY": 30,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
......
This diff is collapsed.
......@@ -6,17 +6,17 @@ export default class HoleEnd extends cc.Component {
isStart: boolean = true;
@property
rotateSpeed: number = 90;
rotateSpeed: number = 180;
@property(cc.Node)
holeEnd2: cc.Node = null;
update(dt: number) {
if (this.isStart) {
const rotationDelta = this.rotateSpeed * dt;
const newRotation = this.node.rotation + rotationDelta;
// const rotationDelta = this.rotateSpeed * dt;
// const newRotation = this.holeEnd2.rotation + rotationDelta;
this.node.rotation = newRotation;
// this.holeEnd2.rotation = newRotation;
}
}
}
......@@ -2,9 +2,12 @@ import UIManager from "../UI/UIManager";
import Brick from "./Brick";
import DataLevel from "./DataLevel";
import GameManager from "./GameManager";
import { TYPEMAP } from "./NodeType";
import Saw from "./Saw";
import Snake from "./Snake";
import Trap from "./Trap";
import Wall from "./Wall";
import Worm from "./Worm";
const { ccclass, property } = cc._decorator;
......@@ -46,7 +49,12 @@ export default class MapManager extends cc.Component {
@property(cc.Prefab)
saw: cc.Prefab = null;
//map: cc.Node[][] = [];
@property(Snake)
snake: Snake = null;
map: number[][] = [];
private listLevelInstance: number[] = [];
private listSpWall: cc.SpriteFrame[] = [];
......@@ -70,7 +78,7 @@ export default class MapManager extends cc.Component {
} else {
this.listSpWall = this.wall3;
}
this.generatePlayerByLevel(level);
if (this.listLevelInstance.includes(level)) {
const childNodeLevel = this.containerLevel.getChildByName("NodePlatformLevel_" + level);
if (childNodeLevel) {
......@@ -91,33 +99,33 @@ export default class MapManager extends cc.Component {
this.offsetMap = 50;
this.is18 = false;
}
// for (let y = 0; y < height; y++) {
// this.map.push([]);
// for (let x = 0; x < width; x++) {
// this.map[y].push(null);
// }
// }
for (let y = 0; y < height; y++) {
this.map.push([]);
for (let x = 0; x < width; x++) {
this.map[y].push(null);
}
}
this.nodeParentPlatform = new cc.Node();
this.nodeParentPlatform.name = "NodePlatformLevel_" + level;
this.nodeParentPlatform.position = cc.v3(0, 0);
this.nodeParentPlatform.parent = this.containerLevel;
let count = dataLevel.bricks.length;
console.log(count);
for (const brick of dataLevel.bricks) {
console.log("AAAAAAA");
let brickNode: cc.Node = this.instanceNodeById(brick);
console.log(brickNode.name);
// brickNode.zIndex = count--;
//this.map[brick.y][brick.x] = brickNode;
if (brickNode != null) {
brickNode.zIndex = count--;
}
this.map[brick.y][brick.x] = brick.id;
}
this.listLevelInstance.push(level);
}
}
instanceNodeById(brickData: Brick): cc.Node {
let node: cc.Node = null;
switch (brickData.id) {
case 1:
case TYPEMAP.WALL:
let brick = new cc.Node();
brick.name = "wall_" + brickData.id;
brick.parent = this.nodeParentPlatform;
......@@ -125,45 +133,54 @@ export default class MapManager extends cc.Component {
if (brickData.index) {
brick.getComponent(cc.Sprite).spriteFrame = this.listSpWall[brickData.index];
} else {
//Tạm
brick.getComponent(cc.Sprite).spriteFrame = this.listSpWall[12];
}
brick.width = this.sizeMap;
brick.height = this.sizeMap;
brick.position = cc.v3(this.offsetMap * brickData.x, this.offsetMap * brickData.y);
console.log(brick.position.toString())
return brick;
case 2:
node = brick;
break;
case TYPEMAP.STONE:
let stone: cc.Node = cc.instantiate(this.stone);
stone.parent = this.nodeParentPlatform;
stone.addComponent(cc.Sprite).spriteFrame = this.stoneSF[this.idBackground - 1];
stone.width = this.offsetMap;
stone.height = this.offsetMap;
stone.position = cc.v3(this.offsetMap * brickData.x, this.offsetMap * brickData.y);
return stone;
case 3:
node = stone;
break;
case TYPEMAP.TRAP:
let trap: cc.Node = cc.instantiate(this.trap);
trap.parent = this.nodeParentPlatform;
trap.getComponent(Trap).updateSize(this.is18);
trap.position = cc.v3(this.offsetMap * brickData.x, this.offsetMap * brickData.y);
return trap;
case 4:
let apple: cc.Node = cc.instantiate(this.stone);
apple.addComponent(cc.Sprite).spriteFrame = this.appleSF[this.idBackground - 1];
node = trap;
break;
case TYPEMAP.APPLE:
let apple: cc.Node = cc.instantiate(this.apple);
apple.parent = this.nodeParentPlatform;
apple.getComponent(cc.Sprite).spriteFrame = this.appleSF[this.idBackground - 1];
apple.width = this.offsetMap;
apple.height = this.offsetMap;
apple.position = cc.v3(this.offsetMap * brickData.x, this.offsetMap * brickData.y);
return apple;
case 7:
node = apple;
break;
case TYPEMAP.SAW:
let saw: cc.Node = cc.instantiate(this.saw);
saw.parent = this.nodeParentPlatform;
saw.width = this.offsetMap;
saw.height = this.offsetMap;
saw.position = cc.v3(this.offsetMap * brickData.x, this.offsetMap * brickData.y);
return saw;
case 8:
node = saw;
break;
case TYPEMAP.END:
let end: cc.Node = cc.instantiate(this.holeEnd);
end.parent = this.nodeParentPlatform;
end.position = cc.v3(this.offsetMap * brickData.x, this.offsetMap * brickData.y);
return end;
node = end;
break;
}
return node;
}
getID(n: number): number {
......@@ -172,4 +189,10 @@ export default class MapManager extends cc.Component {
}
return Math.floor((n - 1) / 3) + 1;
}
}
\ No newline at end of file
generatePlayerByLevel(level: number) {
let worms: Worm [] = GameManager.Instance.dataLevels[level].worms;
this.snake.initializeSnakeView(worms, this.offsetMap, this.is18)
}
}
export const TYPEMAP = {
EMPTY: 0,
WALL: 1,
STONE: 2,
TRAP: 3,
APPLE: 4,
HEAD: 5,
BODY: 6,
SAW: 7,
END: 8
};
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "c2dc0071-5483-4f6f-a60e-0bcd7e778325",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -7,14 +7,22 @@ export default class Saw extends cc.Component {
isStart: boolean = true;
@property
rotateSpeed: number = 90;
rotateSpeed: number = 600;
update(dt: number) {
if (this.isStart) {
const rotationDelta = this.rotateSpeed * dt;
const newRotation = this.node.rotation + rotationDelta;
// const rotationDelta = this.rotateSpeed * dt;
// const newRotation = this.node.rotation + rotationDelta;
this.node.rotation = newRotation;
// this.node.rotation = newRotation;
// const rotationDelta = this.rotateSpeed * dt;
// const newRotation = this.node.rotation + rotationDelta;
// if (newRotation <= this.minRotation) {
// this.node.rotation = this.minRotation;
// } else {
// this.node.rotation = newRotation;
// }
}
}
}
// 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 Worm from "./Worm";
const { ccclass, property } = cc._decorator;
@ccclass
export default class Snake extends cc.Component {
@property(cc.Prefab)
header: cc.Prefab = null;
@property(cc.Prefab)
body: cc.Prefab = null;
@property(cc.Prefab)
tail: cc.Prefab = null;
@property(cc.SpriteFrame)
spHeader: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
spBodyBold: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
spBodyPale: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
spTurnBold: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
spTurnPale: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
spTailBold: cc.SpriteFrame = null;
@property(cc.SpriteFrame)
spTailPale: cc.SpriteFrame = null;
bodies: cc.Node[] = [];
offset: number = 0;
isMap18: boolean = true;
sizeBody: number = 60;
private headerPos: cc.Vec3 = null;
initializeSnakeView(worms: Worm[], offset: number, isMap18: boolean) {
if (isMap18) {
this.node.position.x = -535;
} else {
this.node.position.x = -530;
}
//this.node.removeAllChildren();
for (let index = 0; index < worms.length; index++) {
if (worms[index].stt == 0) {
let header: cc.Node = cc.instantiate(this.header);
header.parent = this.node;
header.getComponent(cc.Sprite).spriteFrame = this.spHeader;
header.zIndex = 100;
header.position = cc.v3(offset * worms[index].x, offset * worms[index].y);
this.headerPos = header.position;
if (isMap18) {
header.width = 60;
header.height = 60;
} else {
header.width = 50;
header.height = 50;
}
this.rotationHead(header, worms[index], worms[index + 1])
}
if (worms[index].stt > 0 && worms[index].stt < worms[worms.length - 1].stt && worms.length > 2) {
let body: cc.Node = cc.instantiate(this.body);
body.parent = this.node;
this.rotationBody(body, worms[index - 1], worms[index + 1], worms[index]);
if (isMap18) {
body.scale = 0.5;
body.width = 120;
body.height = 120;
} else {
body.scale = 0.5;
body.width = 100;
body.height = 100;
}
body.position = cc.v3(offset * worms[index].x, offset * worms[index].y);
} else if (worms[index].stt == worms[worms.length - 1].stt) {
let tail: cc.Node = cc.instantiate(this.tail);
tail.parent = this.node;
tail.getComponent(cc.Sprite).spriteFrame = worms[index].stt % 2 ? this.spTailBold : this.spTailPale;
if (isMap18) {
tail.scale = 0.5;
tail.width = 120;
tail.height = 120;
} else {
tail.scale = 0.5;
tail.width = 100;
tail.height = 100;
}
tail.position = cc.v3(offset * worms[index].x, offset * worms[index].y);
if (worms[index - 1].x == worms[index].x) {
tail.rotation = 90;
} else if (worms[index].y == worms[index].y) {
tail.rotation = 0;
}
}
}
}
rotationHead(node: cc.Node, posHeader, posBody) {
if (posHeader.y == posBody.y && posHeader.x != posBody.x) {
if (posHeader.x - posBody.x > 0) {
node.angle = 0
node.scale = 1;
} else {
node.angle = 0
node.scale = -1;
}
} else if (posHeader.x == posBody.x && posHeader.y != posBody.y) {
if (posHeader.y - posBody.y > 0) {
node.angle = 90
node.scale = 1;
} else {
node.angle = -90
node.scale = 1;
}
}
}
rotationBody(nodeCenter: cc.Node, posBefore, posAfter, posCenter) {
if (!posCenter || !posBefore || !posAfter) {
return;
}
if (posBefore.x != posAfter.x && posBefore.y != posAfter.y) {
nodeCenter.getComponent(cc.Sprite).spriteFrame = posCenter.stt % 2 ? this.spTurnBold : this.spTurnPale;
if (posBefore.y == posCenter.y) {
if (posBefore.x > posCenter.x) {
if (posAfter.y > posCenter.y) {
nodeCenter.angle = -90;
} else {
nodeCenter.angle = 180;
}
} else {
if (posAfter.y > posCenter.y) {
nodeCenter.angle = 0;
} else {
nodeCenter.angle = 90;
}
}
} else if (posBefore.x == posCenter.x) {
if (posBefore.y > posCenter.y) {
if (posAfter.x > posCenter.x) {
nodeCenter.angle = -90;
} else {
nodeCenter.angle = 0;
}
} else {
if (posAfter.x > posCenter.x) {
nodeCenter.angle = 180;
} else {
nodeCenter.angle = 90;
}
}
}
} else if (posBefore.x == posAfter.x && posCenter.x == posBefore.x && posCenter.x == posAfter.x) {
nodeCenter.getComponent(cc.Sprite).spriteFrame = posCenter.stt % 2 ? this.spBodyBold : this.spBodyPale;
nodeCenter.angle = 90;
} else if (posBefore.y == posAfter.y && posCenter.y == posBefore.y && posCenter.y == posAfter.y) {
nodeCenter.angle = 0;
}
}
moveUp(){
}
moveDown(){
}
moveLeft(){
}
moveRight(){
}
handlePlayerInput(displcement: cc.Vec3){
}
moveSnakeAndPushStone(displcement: cc.Vec3){
}
checkAndHandleFallings(){
}
}
{
"ver": "1.1.0",
"uuid": "c12ff254-aa28-421c-b0cf-a57836aacc94",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
import Snake from "../../GamePlay/Snake";
import UIManager from "../UIManager";
import ScreenUI, { ScreenName } from "./ScreenUI";
......@@ -13,10 +14,30 @@ const { ccclass, property } = cc._decorator;
@ccclass
export default class InGameScreen extends ScreenUI {
@property(Snake)
sake: Snake = null;
override initialize(uiManager: UIManager): void {
super.initialize(uiManager);
this.screenName = ScreenName.INGAME;
}
onButtonUp() {
this.sake.moveUp();
}
onButtonDown() {
this.sake.moveDown();
}
onButtonLeft() {
this.sake.moveLeft();
}
onButtonRight() {
this.sake.moveRight();
}
override active(): void {
super.active();
}
......@@ -25,4 +46,6 @@ export default class InGameScreen extends ScreenUI {
super.deactive();
}
}
......@@ -22,7 +22,7 @@ export default class LevelScreen extends ScreenUI {
containerNodePage: cc.Node = null;
@property(cc.Vec3)
pageStep: cc.Vec3 = new cc.Vec3(850, 0, 0);
pageStep: cc.Vec3 = new cc.Vec3(1050, 0, 0);
@property(cc.Label)
txtBtnLevel: cc.Label = null;
......
......@@ -48,8 +48,9 @@ export default class MainScreen extends ScreenUI {
if (this.containerSkins.childrenCount == 0) {
worm.position = cc.v3(0, 0);
} else {
worm.position = cc.v3(450);
worm.position = cc.v3(650);
}
worm.scale = 1.4;
this.listWorm.push({
id: index,
nodeWorm: worm
......@@ -72,7 +73,7 @@ export default class MainScreen extends ScreenUI {
}
}
}
this.listWorm[this.currentIndex].nodeWorm.scale = 1.5;
}
showListWorm() {
......@@ -94,7 +95,7 @@ export default class MainScreen extends ScreenUI {
if (index == 0) {
this.listWorm[index].nodeWorm.position = cc.v3(0, 0);
} else {
this.listWorm[index].nodeWorm.position = cc.v3(450);
this.listWorm[index].nodeWorm.position = cc.v3(650);
}
}
}
......@@ -116,19 +117,19 @@ export default class MainScreen extends ScreenUI {
moveItems(isNext: boolean) {
this.isMove = false;
cc.tween(this.listWorm[this.currentIndex].nodeWorm)
.to(this.moveDuration, { position: cc.v3(0, 0), scale: 1.2 })
.to(this.moveDuration, { position: cc.v3(0, 0), scale: 1.5 })
.call(() => {
this.isMove = true;
})
.start();
if (isNext) {
cc.tween(this.listWorm[this.currentIndex - 1].nodeWorm)
.to(this.moveDuration, { position: cc.v3(-450, 0), scale: 1 })
.to(this.moveDuration, { position: cc.v3(-650, 0), scale: 1 })
.start();
} else {
cc.tween(this.listWorm[this.currentIndex + 1].nodeWorm)
.to(this.moveDuration, { position: cc.v3(450, 0), scale: 1 })
.to(this.moveDuration, { position: cc.v3(650, 0), scale: 1 })
.start();
}
}
......
......@@ -17,15 +17,15 @@
"uuid": "c82e126c-f179-4c2d-a4c2-2380e974a54b",
"importer": "sprite-frame",
"rawTextureUuid": "8dbde2ba-2b89-490f-88f3-fbd33b79a7c3",
"trimType": "custom",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -2,
"offsetY": 5.5,
"offsetY": 0,
"trimX": 36,
"trimY": 26,
"trimY": 40,
"width": 124,
"height": 137,
"height": 120,
"rawWidth": 200,
"rawHeight": 200,
"borderTop": 0,
......
[
{"id":1,"width":18,"height":10,"bricks":[{"x":2,"y":6,"id":6}, {"x":3,"y":6,"id":5},{"x":4,"y":5,"id":7},{"x":6,"y":5,"id":7},{"x":8,"y":5,"id":7}, {"x":10,"y":5,"id":7},{"x":7,"y":6,"id":4},{"x":3,"y":5,"id":1},{"x":4,"y":4,"id":1},{"x":5,"y":5,"id":1},{"x":6,"y":4,"id":1},{"x":7,"y":5,"id":1},{"x":8,"y":4,"id":1},{"x":9,"y":5,"id":1},{"x":10,"y":4,"id":1},{"x":11,"y":4,"id":1,"index": 10},{"x":12,"y":5,"id":1},{"x":14,"y":7,"id":8}],"hints":[{"x":4,"y":6,"d":2},{"x":5,"y":6,"d":2},{"x":6,"y":6,"d":2},{"x":7,"y":6,"d":2},{"x":8,"y":6,"d":2},{"x":9,"y":6,"d":2},{"x":10,"y":6,"d":2},{"x":11,"y":6,"d":2},{"x":12,"y":6,"d":2},{"x":12,"y":7,"d":3},{"x":13,"y":7,"d":2},{"x":14,"y":7,"d":2}],"worms":[{"stt":0,"x":3,"y":6},{"stt":1,"x":2,"y":6}]},
{"id":1,"width":18,"height":10,"bricks":[{"x":7,"y":6,"id":4},{"x":3,"y":5,"id":1},{"x":4,"y":5,"id":7},{"x":4,"y":4,"id":1},{"x":5,"y":5,"id":1},{"x":6,"y":5,"id":7},{"x":6,"y":4,"id":1},{"x":7,"y":5,"id":1},{"x":8,"y":5,"id":7},{"x":8,"y":4,"id":1},{"x":9,"y":5,"id":1},{"x":10,"y":5,"id":7},{"x":10,"y":4,"id":1,"index": 10},{"x":11,"y":4,"id":1},{"x":12,"y":5,"id":1},{"x":5,"y":6,"id":5},{"x":4,"y":6,"id":6},{"x":4,"y":7,"id":6},{"x":3,"y":7,"id":6},{"x":3,"y":6,"id":6},{"x":2,"y":6,"id":6},{"x":2,"y":5,"id":6},{"x":1,"y":5,"id":6},{"x":14,"y":7,"id":8}],"hints":[{"x":4,"y":6,"d":2},{"x":5,"y":6,"d":2},{"x":6,"y":6,"d":2},{"x":7,"y":6,"d":2},{"x":8,"y":6,"d":2},{"x":9,"y":6,"d":2},{"x":10,"y":6,"d":2},{"x":11,"y":6,"d":2},{"x":12,"y":6,"d":2},{"x":12,"y":7,"d":3},{"x":13,"y":7,"d":2},{"x":14,"y":7,"d":2}],"worms":[{"stt":0,"x":5,"y":6},{"stt":1,"x":4,"y":6},{"stt":2,"x":4,"y":7},{"stt":3,"x":3,"y":7},{"stt":4,"x":3,"y":6},{"stt":5,"x":2,"y":6},{"stt":6,"x":2,"y":5},{"stt":7,"x":1,"y":5}]},
{"id":2,"width":18,"height":10,"bricks":[{"x":1,"y":6,"id":6},{"x":2,"y":5,"id":1},{"x":2,"y":6,"id":5},{"x":3,"y":5,"id":1},{"x":4,"y":6,"id":1},{"x":5,"y":5,"id":1},{"x":6,"y":5,"id":1},{"x":7,"y":6,"id":1},{"x":8,"y":7,"id":4},{"x":10,"y":6,"id":1},{"x":11,"y":5,"id":1},{"x":12,"y":4,"id":1},{"x":13,"y":3,"id":1},{"x":15,"y":4,"id":8}],"hints":[{"x":3,"y":6,"d":2},{"x":3,"y":7,"d":3},{"x":4,"y":7,"d":2},{"x":5,"y":7,"d":2},{"x":6,"y":7,"d":2},{"x":6,"y":7,"d":3},{"x":7,"y":7,"d":2},{"x":8,"y":7,"d":2},{"x":9,"y":7,"d":2},{"x":10,"y":7,"d":2},{"x":11,"y":7,"d":2},{"x":12,"y":7,"d":2},{"x":13,"y":7,"d":2},{"x":14,"y":6,"d":2},{"x":15,"y":5,"d":2},{"x":15,"y":4,"d":4}],"worms":[{"stt":0,"x":2,"y":6},{"stt":1,"x":1,"y":6}]},
{"id":3,"width":18,"height":10,"bricks":[{"x":1,"y":1,"id":6},{"x":1,"y":2,"id":6},{"x":2,"y":1,"id":1},{"x":2,"y":2,"id":5},{"x":3,"y":1,"id":1},{"x":3,"y":2,"id":1},{"x":4,"y":1,"id":1},{"x":4,"y":2,"id":1},{"x":4,"y":3,"id":1},{"x":5,"y":1,"id":1},{"x":5,"y":2,"id":1},{"x":5,"y":3,"id":1},{"x":5,"y":4,"id":1},{"x":6,"y":1,"id":1},{"x":6,"y":2,"id":1},{"x":6,"y":3,"id":1},{"x":6,"y":4,"id":1},{"x":6,"y":5,"id":1},{"x":7,"y":6,"id":1},{"x":8,"y":8,"id":4},{"x":9,"y":6,"id":1},{"x":10,"y":1,"id":1},{"x":10,"y":2,"id":1},{"x":10,"y":3,"id":1},{"x":10,"y":4,"id":1},{"x":10,"y":5,"id":1},{"x":11,"y":1,"id":1},{"x":11,"y":2,"id":1},{"x":11,"y":3,"id":1},{"x":11,"y":4,"id":1},{"x":12,"y":1,"id":1},{"x":12,"y":2,"id":1},{"x":12,"y":3,"id":1},{"x":13,"y":1,"id":1},{"x":13,"y":2,"id":1},{"x":14,"y":1,"id":1},{"x":16,"y":4,"id":8}],"hints":[{"x":2,"y":3,"d":3},{"x":3,"y":3,"d":2},{"x":3,"y":4,"d":3},{"x":4,"y":4,"d":2},{"x":4,"y":5,"d":3},{"x":5,"y":5,"d":2},{"x":5,"y":6,"d":3},{"x":6,"y":6,"d":2},{"x":6,"y":7,"d":3},{"x":7,"y":7,"d":2},{"x":7,"y":8,"d":3},{"x":8,"y":8,"d":2},{"x":9,"y":8,"d":2},{"x":10,"y":8,"d":2},{"x":11,"y":7,"d":2},{"x":12,"y":7,"d":2},{"x":13,"y":7,"d":2},{"x":14,"y":6,"d":2},{"x":15,"y":5,"d":2},{"x":16,"y":4,"d":2}],"worms":[{"stt":0,"x":2,"y":2},{"stt":1,"x":1,"y":2},{"stt":2,"x":1,"y":1}]},
{"id":4,"width":18,"height":10,"bricks":[{"x":3,"y":6,"id":1},{"x":3,"y":7,"id":4},{"x":4,"y":6,"id":1},{"x":5,"y":6,"id":1},{"x":6,"y":3,"id":1},{"x":6,"y":5,"id":1},{"x":7,"y":3,"id":1},{"x":8,"y":3,"id":1},{"x":8,"y":4,"id":5},{"x":9,"y":3,"id":6},{"x":9,"y":4,"id":6},{"x":9,"y":6,"id":1},{"x":10,"y":6,"id":1},{"x":11,"y":6,"id":1},{"x":11,"y":7,"id":8}],"hints":[{"x":7,"y":4,"d":1},{"x":7,"y":5,"d":3},{"x":7,"y":6,"d":3},{"x":6,"y":6,"d":1},{"x":6,"y":7,"d":3},{"x":5,"y":7,"d":1},{"x":4,"y":7,"d":1},{"x":3,"y":7,"d":1},{"x":3,"y":8,"d":3},{"x":4,"y":8,"d":2},{"x":5,"y":8,"d":2},{"x":6,"y":8,"d":2},{"x":7,"y":7,"d":2},{"x":8,"y":7,"d":2},{"x":9,"y":7,"d":2},{"x":10,"y":7,"d":2},{"x":11,"y":7,"d":2}],"worms":[{"stt":0,"x":8,"y":4},{"stt":1,"x":9,"y":4},{"stt":2,"x":9,"y":3}]},
......
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