Minor fix.

This commit is contained in:
genxium 2022-11-20 21:07:45 +08:00
parent 335fef66ef
commit d21f59cafa
7 changed files with 15 additions and 25 deletions

View File

@ -440,7 +440,7 @@
"array": [ "array": [
0, 0,
0, 0,
239.32248305180272, 216.50635094610968,
0, 0,
0, 0,
0, 0,

View File

@ -453,7 +453,7 @@
"array": [ "array": [
0, 0,
0, 0,
239.32248305180272, 216.50635094610968,
0, 0,
0, 0,
0, 0,

View File

@ -6,6 +6,11 @@ window.ATK_CHARACTER_STATE = {
Atk1: [2, "Atk1"], Atk1: [2, "Atk1"],
}; };
window.ATK_CHARACTER_STATE_ARR = [];
for (let k in window.ATK_CHARACTER_STATE) {
window.ATK_CHARACTER_STATE_ARR.push(window.ATK_CHARACTER_STATE[k]);
}
cc.Class({ cc.Class({
extends: BaseCharacter, extends: BaseCharacter,
properties: { properties: {
@ -44,17 +49,11 @@ cc.Class({
} }
if (newCharacterState != this.characterState) { if (newCharacterState != this.characterState) {
switch (newCharacterState) {
case ATK_CHARACTER_STATE.Idle1[0]:
this.animComp.playAnimation(ATK_CHARACTER_STATE.Idle1[1]);
break;
case ATK_CHARACTER_STATE.Walking[0]:
this.animComp.playAnimation(ATK_CHARACTER_STATE.Walking[1]);
break;
default:
break;
}
this.characterState = newCharacterState; this.characterState = newCharacterState;
const newAnimName = window.ATK_CHARACTER_STATE_ARR[newCharacterState][1];
if (newAnimName != this.animComp.animationName) {
this.animComp.playAnimation(newAnimName);
}
} }
}, },
}); });

View File

@ -8,17 +8,13 @@ module.export = cc.Class({
} }
}, },
// LIFE-CYCLE CALLBACKS: ctor() {
start() { this.activeDirection = {
const self = this;
self.activeDirection = {
dx: 0, dx: 0,
dy: 0 dy: 0
}; };
}, },
ctor() {},
onLoad() { onLoad() {
const self = this; const self = this;
const canvasNode = self.mapNode.parent; const canvasNode = self.mapNode.parent;

View File

@ -12,9 +12,6 @@ cc.Class({
default: null default: null
} }
}, },
start() {
AttackingCharacter.prototype.start.call(this);
},
onLoad() { onLoad() {
AttackingCharacter.prototype.onLoad.call(this); AttackingCharacter.prototype.onLoad.call(this);

View File

@ -976,14 +976,12 @@ cc.Class({
const wpos = self.virtualGridToWorldPos(immediatePlayerInfo.virtualGridX, immediatePlayerInfo.virtualGridY); const wpos = self.virtualGridToWorldPos(immediatePlayerInfo.virtualGridX, immediatePlayerInfo.virtualGridY);
const dx = (wpos[0] - playerRichInfo.node.x); const dx = (wpos[0] - playerRichInfo.node.x);
const dy = (wpos[1] - playerRichInfo.node.y); const dy = (wpos[1] - playerRichInfo.node.y);
const justJiggling = (self.jigglingEps1D >= Math.abs(dx) && self.jigglingEps1D >= Math.abs(dy)); //const justJiggling = (self.jigglingEps1D >= Math.abs(dx) && self.jigglingEps1D >= Math.abs(dy));
//if (!justJiggling) {
playerRichInfo.node.setPosition(wpos[0], wpos[1]); playerRichInfo.node.setPosition(wpos[0], wpos[1]);
playerRichInfo.virtualGridX = immediatePlayerInfo.virtualGridX; playerRichInfo.virtualGridX = immediatePlayerInfo.virtualGridX;
playerRichInfo.virtualGridY = immediatePlayerInfo.virtualGridY; playerRichInfo.virtualGridY = immediatePlayerInfo.virtualGridY;
playerRichInfo.scriptIns.scheduleNewDirection(immediatePlayerInfo.dir, false); playerRichInfo.scriptIns.scheduleNewDirection(immediatePlayerInfo.dir, false);
playerRichInfo.scriptIns.updateSpeed(immediatePlayerInfo.speed); playerRichInfo.scriptIns.updateSpeed(immediatePlayerInfo.speed);
//}
}); });
}, },

View File

@ -149,7 +149,7 @@ cc.Class({
players: { players: {
10: { 10: {
id: 10, id: 10,
joinIndex: 2, joinIndex: 1,
virtualGridX: 0, virtualGridX: 0,
virtualGridY: 0, virtualGridY: 0,
speed: 2 * self.worldToVirtualGridRatio, speed: 2 * self.worldToVirtualGridRatio,