Minor fix.

This commit is contained in:
genxium 2022-12-10 13:46:24 +08:00
parent 66dfcaa0f5
commit 195a400dc2
19 changed files with 1668 additions and 13631 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"width":64,"imagePath":"SoldierFireGhost_tex.png","SubTexture":[{"frameWidth":12,"y":42,"frameHeight":11,"width":11,"frameX":-1,"height":11,"name":"biu","frameY":0,"x":16},{"width":5,"y":42,"height":7,"name":"rightArm","x":29},{"frameWidth":15,"y":27,"frameHeight":16,"width":13,"frameX":-1,"height":16,"name":"yinmoqe00","frameY":0,"x":1},{"width":17,"y":1,"height":21,"name":"body","x":28},{"width":5,"y":42,"height":7,"name":"rightShoulder","x":36},{"width":10,"y":45,"height":9,"name":"rightFrontArm","x":1},{"width":7,"y":56,"height":7,"name":"rightHand","x":1},{"width":6,"y":55,"height":6,"name":"leftArm","x":32},{"width":7,"y":55,"height":6,"name":"leftShoulder","x":23},{"width":10,"y":27,"height":11,"name":"leftFrontArm","x":16},{"width":17,"y":24,"height":16,"name":"head","x":28},{"width":25,"y":1,"height":24,"name":"head2","x":1},{"width":8,"y":55,"height":7,"name":"leftHand","x":13},{"frameWidth":4,"y":51,"frameHeight":4,"width":2,"frameX":-1,"height":2,"name":"huomiao01","frameY":-1,"x":29}],"height":64,"name":"SoldierFireGhost"}
{"imagePath":"SoldierFireGhost_tex.png","width":64,"height":64,"name":"SoldierFireGhost","SubTexture":[{"frameY":0,"y":42,"frameWidth":12,"frameHeight":11,"width":11,"height":11,"name":"biu","frameX":-1,"x":16},{"width":5,"y":42,"height":7,"name":"rightArm","x":29},{"frameY":0,"y":27,"frameWidth":15,"frameHeight":16,"width":13,"height":16,"name":"yinmoqe00","frameX":-1,"x":1},{"width":17,"y":1,"height":21,"name":"body","x":28},{"width":5,"y":42,"height":7,"name":"rightShoulder","x":36},{"width":10,"y":45,"height":9,"name":"rightFrontArm","x":1},{"width":7,"y":56,"height":7,"name":"rightHand","x":1},{"width":6,"y":55,"height":6,"name":"leftArm","x":32},{"width":7,"y":55,"height":6,"name":"leftShoulder","x":23},{"width":10,"y":27,"height":11,"name":"leftFrontArm","x":16},{"width":25,"y":1,"height":24,"name":"head2","x":1},{"width":17,"y":24,"height":16,"name":"head","x":28},{"width":8,"y":55,"height":7,"name":"leftHand","x":13},{"frameY":-1,"y":51,"frameWidth":4,"frameHeight":4,"width":2,"height":2,"name":"huomiao01","frameX":-1,"x":29}]}

View File

@ -1,7 +1,7 @@
{
"ver": "1.0.0",
"uuid": "4a9187d5-a9ad-4464-a03c-d2f3cc277051",
"atlasJson": "{\"width\":64,\"imagePath\":\"SoldierFireGhost_tex.png\",\"SubTexture\":[{\"frameWidth\":12,\"y\":42,\"frameHeight\":11,\"width\":11,\"frameX\":-1,\"height\":11,\"name\":\"biu\",\"frameY\":0,\"x\":16},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightArm\",\"x\":29},{\"frameWidth\":15,\"y\":27,\"frameHeight\":16,\"width\":13,\"frameX\":-1,\"height\":16,\"name\":\"yinmoqe00\",\"frameY\":0,\"x\":1},{\"width\":17,\"y\":1,\"height\":21,\"name\":\"body\",\"x\":28},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightShoulder\",\"x\":36},{\"width\":10,\"y\":45,\"height\":9,\"name\":\"rightFrontArm\",\"x\":1},{\"width\":7,\"y\":56,\"height\":7,\"name\":\"rightHand\",\"x\":1},{\"width\":6,\"y\":55,\"height\":6,\"name\":\"leftArm\",\"x\":32},{\"width\":7,\"y\":55,\"height\":6,\"name\":\"leftShoulder\",\"x\":23},{\"width\":10,\"y\":27,\"height\":11,\"name\":\"leftFrontArm\",\"x\":16},{\"width\":17,\"y\":24,\"height\":16,\"name\":\"head\",\"x\":28},{\"width\":25,\"y\":1,\"height\":24,\"name\":\"head2\",\"x\":1},{\"width\":8,\"y\":55,\"height\":7,\"name\":\"leftHand\",\"x\":13},{\"frameWidth\":4,\"y\":51,\"frameHeight\":4,\"width\":2,\"frameX\":-1,\"height\":2,\"name\":\"huomiao01\",\"frameY\":-1,\"x\":29}],\"height\":64,\"name\":\"SoldierFireGhost\"}",
"atlasJson": "{\"imagePath\":\"SoldierFireGhost_tex.png\",\"width\":64,\"height\":64,\"name\":\"SoldierFireGhost\",\"SubTexture\":[{\"frameY\":0,\"y\":42,\"frameWidth\":12,\"frameHeight\":11,\"width\":11,\"height\":11,\"name\":\"biu\",\"frameX\":-1,\"x\":16},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightArm\",\"x\":29},{\"frameY\":0,\"y\":27,\"frameWidth\":15,\"frameHeight\":16,\"width\":13,\"height\":16,\"name\":\"yinmoqe00\",\"frameX\":-1,\"x\":1},{\"width\":17,\"y\":1,\"height\":21,\"name\":\"body\",\"x\":28},{\"width\":5,\"y\":42,\"height\":7,\"name\":\"rightShoulder\",\"x\":36},{\"width\":10,\"y\":45,\"height\":9,\"name\":\"rightFrontArm\",\"x\":1},{\"width\":7,\"y\":56,\"height\":7,\"name\":\"rightHand\",\"x\":1},{\"width\":6,\"y\":55,\"height\":6,\"name\":\"leftArm\",\"x\":32},{\"width\":7,\"y\":55,\"height\":6,\"name\":\"leftShoulder\",\"x\":23},{\"width\":10,\"y\":27,\"height\":11,\"name\":\"leftFrontArm\",\"x\":16},{\"width\":25,\"y\":1,\"height\":24,\"name\":\"head2\",\"x\":1},{\"width\":17,\"y\":24,\"height\":16,\"name\":\"head\",\"x\":28},{\"width\":8,\"y\":55,\"height\":7,\"name\":\"leftHand\",\"x\":13},{\"frameY\":-1,\"y\":51,\"frameWidth\":4,\"frameHeight\":4,\"width\":2,\"height\":2,\"name\":\"huomiao01\",\"frameX\":-1,\"x\":29}]}",
"texture": "700d963b-2192-4219-a066-8be5b3db7453",
"subMetas": {}
}

View File

@ -0,0 +1,205 @@
{
"__type__": "cc.AnimationClip",
"_name": "InAirIdle1",
"_objFlags": 0,
"_native": "",
"_duration": 0.5166666666666667,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "dd02916e-9ac8-4fe7-a944-d6082eb9007a"
}
},
{
"frame": 0.016666666666666666,
"value": {
"__uuid__": "1906b14b-f3a2-4dc9-9e0d-99e3b334e67b"
}
},
{
"frame": 0.03333333333333333,
"value": {
"__uuid__": "1b4f284c-be67-403b-9f5d-59aa641d3c92"
}
},
{
"frame": 0.05,
"value": {
"__uuid__": "6feb197e-2013-48fd-bbbb-3d2809cb1d63"
}
},
{
"frame": 0.06666666666666667,
"value": {
"__uuid__": "2db4e807-a5d2-4c09-b033-a0ae97e5d0bf"
}
},
{
"frame": 0.08333333333333333,
"value": {
"__uuid__": "73958a6b-31a7-4bb8-babd-1aefba55a793"
}
},
{
"frame": 0.1,
"value": {
"__uuid__": "9545ca77-8002-4ad1-a91e-1e343cdf0e0b"
}
},
{
"frame": 0.11666666666666667,
"value": {
"__uuid__": "581e4c15-9de3-4b72-a91a-2e82ac6b092c"
}
},
{
"frame": 0.13333333333333333,
"value": {
"__uuid__": "4af94082-f36b-4b9e-9077-bd458fd0b188"
}
},
{
"frame": 0.15,
"value": {
"__uuid__": "5463290d-7b25-4625-8be5-1a16dbe3bd83"
}
},
{
"frame": 0.16666666666666666,
"value": {
"__uuid__": "e507775a-1009-47a8-b1a8-8ade0104e4c2"
}
},
{
"frame": 0.18333333333333332,
"value": {
"__uuid__": "6583a9e1-92fb-4db2-9437-9d2b26bc5920"
}
},
{
"frame": 0.2,
"value": {
"__uuid__": "b07e2da2-d1f2-4ec8-acdf-92706d0be9e0"
}
},
{
"frame": 0.21666666666666667,
"value": {
"__uuid__": "dd60bf4f-6b5f-4385-9e46-1e49e6a7cfbe"
}
},
{
"frame": 0.23333333333333334,
"value": {
"__uuid__": "46811e43-c874-41d5-8799-6fafc904cd5a"
}
},
{
"frame": 0.25,
"value": {
"__uuid__": "0a370e7e-e25f-4faf-9a76-73b246338a4d"
}
},
{
"frame": 0.26666666666666666,
"value": {
"__uuid__": "1f003135-e929-4a05-9029-76e7cb8c76ef"
}
},
{
"frame": 0.2833333333333333,
"value": {
"__uuid__": "b78015ba-98e4-4ccd-9852-a7ec053a0ba4"
}
},
{
"frame": 0.3,
"value": {
"__uuid__": "0589abef-dc0d-4d33-a084-25b273ca1368"
}
},
{
"frame": 0.31666666666666665,
"value": {
"__uuid__": "20542755-bbfa-43cd-b593-e73d121b5ed6"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "5d5ac5af-3da7-4b22-9183-5885736e2ca7"
}
},
{
"frame": 0.35,
"value": {
"__uuid__": "47bbe2a2-a983-4aca-8a3e-6cd6df5eee03"
}
},
{
"frame": 0.36666666666666664,
"value": {
"__uuid__": "6d3fb572-d6af-4b7e-9350-9ff482569127"
}
},
{
"frame": 0.38333333333333336,
"value": {
"__uuid__": "573cfba0-4534-4886-849a-61f4f2cbd349"
}
},
{
"frame": 0.4,
"value": {
"__uuid__": "0b4ebd8a-6316-4802-aa24-49ab08e6a75b"
}
},
{
"frame": 0.4166666666666667,
"value": {
"__uuid__": "5b7fff7b-5818-4be8-b65d-c212d15e6e71"
}
},
{
"frame": 0.43333333333333335,
"value": {
"__uuid__": "f964ec77-c016-44fa-8f55-3e59ae30283d"
}
},
{
"frame": 0.45,
"value": {
"__uuid__": "679a79eb-85c6-4445-8517-36465c57c6da"
}
},
{
"frame": 0.4666666666666667,
"value": {
"__uuid__": "8764bb9b-4b08-4bc5-b9e5-93af39321c70"
}
},
{
"frame": 0.48333333333333334,
"value": {
"__uuid__": "f291785e-2685-4ba0-b38b-9607972ce6f0"
}
},
{
"frame": 0.5,
"value": {
"__uuid__": "a4e84eb9-b866-4cdc-8925-a5d29c65aea5"
}
}
]
}
}
},
"events": []
}

View File

@ -0,0 +1,5 @@
{
"ver": "2.1.0",
"uuid": "43dbf141-be76-48c3-bdef-29233ccbe30d",
"subMetas": {}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 470 KiB

After

Width:  |  Height:  |  Size: 238 KiB

View File

@ -747,6 +747,16 @@
},
{
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
},
null,
{
"__uuid__": "c738236a-0702-45f8-aa38-99457b051997"
},
{
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
},
{
"__uuid__": "43dbf141-be76-48c3-bdef-29233ccbe30d"
}
],
"playOnLoad": false,

View File

@ -1,151 +0,0 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "SoldierFireGhost",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1425,
"height": 1024
},
"_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.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_defaultClip": null,
"_clips": [
{
"__uuid__": "252b321f-81f4-485c-85bd-ea44d298cb76"
},
null,
null,
null,
{
"__uuid__": "c738236a-0702-45f8-aa38-99457b051997"
},
{
"__uuid__": "f51bb583-0010-48f3-a6a1-451a78ac2d65"
},
{
"__uuid__": "c69bcceb-d7d1-4e33-9623-e2a374a0a6b6"
}
],
"playOnLoad": false,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": {
"__uuid__": "145769c8-a259-42bc-8cce-6e035f493c70"
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "44k8wsxglPsJSrMCX58Yve",
"sync": false
}
]

View File

@ -1,8 +0,0 @@
{
"ver": "1.2.5",
"uuid": "e3fc2487-17d1-4ff9-ae1f-38e974509077",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}

View File

@ -454,7 +454,7 @@
"array": [
0,
0,
210.14647688706773,
216.50635094610968,
0,
0,
0,

View File

@ -5,7 +5,7 @@ window.ATK_CHARACTER_STATE = {
Walking: [1, "Walking"],
Atk1: [2, "Atk1"],
Atked1: [3, "Atked1"],
InAirIdle1: [4, "Idle1"],
InAirIdle1: [4, "InAirIdle1"],
InAirAtk1: [5, "Atk1"],
InAirAtked1: [6, "Atked1"],
};

View File

@ -186,6 +186,40 @@ cc.Class({
},
spawnPlayerNode(joinIndex, vx, vy, playerDownsyncInfo) {
const self = this;
const newPlayerNode = cc.instantiate(self.controlledCharacterPrefab)
const playerScriptIns = newPlayerNode.getComponent("ControlledCharacter");
if (1 == joinIndex) {
playerScriptIns.setSpecies("SoldierWaterGhost");
} else if (2 == joinIndex) {
playerScriptIns.setSpecies("SoldierFireGhost");
}
const [wx, wy] = self.virtualGridToWorldPos(vx, vy);
newPlayerNode.setPosition(wx, wy);
playerScriptIns.mapNode = self.node;
const colliderWidth = playerDownsyncInfo.colliderRadius * 2,
colliderHeight = playerDownsyncInfo.colliderRadius * 2.5;
const [x0, y0] = self.virtualGridToPolygonColliderAnchorPos(vx, vy, colliderWidth, colliderHeight),
pts = [[0, 0], [colliderWidth, 0], [colliderWidth, colliderHeight], [0, colliderHeight]];
const newPlayerCollider = self.collisionSys.createPolygon(x0, y0, pts);
const collisionPlayerIndex = self.collisionPlayerIndexPrefix + joinIndex;
newPlayerCollider.data = playerDownsyncInfo;
self.collisionSysMap.set(collisionPlayerIndex, newPlayerCollider);
console.log(`Created new player collider: joinIndex=${joinIndex}, colliderRadius=${playerDownsyncInfo.colliderRadius}`);
safelyAddChild(self.node, newPlayerNode);
setLocalZOrder(newPlayerNode, 5);
newPlayerNode.active = true;
playerScriptIns.updateCharacterAnim(playerDownsyncInfo, null, true);
return [newPlayerNode, playerScriptIns];
},
update(dt) {
const self = this;
if (ALL_BATTLE_STATES.IN_BATTLE == self.battleState) {
@ -328,11 +362,11 @@ cc.Class({
}
bulletPushbacks[joinIndex - 1][0] += xfac * bulletCollider.data.pushback; // Only for straight punch, there's no y-pushback
bulletPushbacks[joinIndex - 1][1] += 0;
const thatAckedPlayerInCurFrame = currRenderFrame.players[potential.data.id];
const thatAckedPlayerInNextFrame = nextRenderFramePlayers[potential.data.id];
if (!window.ATK_CHARACTER_STATE_IN_AIR_SET.has(thatAckedPlayerInNextFrame.characterState)) {
thatAckedPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Atked1[0];
} else {
thatAckedPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.InAirAtked1[0];
thatAckedPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Atked1[0];
if (thatAckedPlayerInCurFrame.inAir) {
thatAckedPlayerInNextFrame.characterState = window.toInAirConjugate(thatAckedPlayerInNextFrame.characterState);
}
const oldFramesToRecover = thatAckedPlayerInNextFrame.framesToRecover;
thatAckedPlayerInNextFrame.framesToRecover = (oldFramesToRecover > bulletCollider.data.hitStunFrames ? oldFramesToRecover : bulletCollider.data.hitStunFrames); // In case the hit player is already stun, we extend it
@ -416,6 +450,7 @@ cc.Class({
// console.log(`A rising-edge of meleeBullet is created at renderFrame.id=${currRenderFrame.id}, delayedInputFrame.id=${delayedInputFrame.inputFrameId}`);
thatPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Atk1[0];
thatPlayerInNextFrame.velX = 0; // prohibits simultaneous movement with Atk1 (including inAir)
}
} else if (0 == decodedInput.btnALevel && 1 == prevBtnALevel) {
// console.log(`playerId=${playerId} triggered a falling-edge of btnA at renderFrame.id=${currRenderFrame.id}, delayedInputFrame.id=${delayedInputFrame.inputFrameId}`);
@ -425,13 +460,16 @@ cc.Class({
// Update directions and thus would eventually update moving animation accordingly
thatPlayerInNextFrame.dirX = decodedInput.dx;
thatPlayerInNextFrame.dirY = decodedInput.dy;
thatPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Walking[0];
thatPlayerInNextFrame.velX = decodedInput.dx * currPlayerDownsync.speed;
thatPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Walking[0];
} else {
thatPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Idle1[0];
thatPlayerInNextFrame.velX = 0;
}
}
if (currPlayerDownsync.inAir) {
thatPlayerInNextFrame.characterState = window.toInAirConjugate(thatPlayerInNextFrame.characterState);
}
}
}
@ -472,17 +510,17 @@ cc.Class({
effPushbacks[joinIndex - 1][0] += pushbackX;
effPushbacks[joinIndex - 1][1] += pushbackY;
}
if (false == jumpTriggered[joinIndex-1] && null != snappedIntoPlatformEx && null != snappedIntoPlatformEy) {
if (false == jumpTriggered[joinIndex - 1] && null != snappedIntoPlatformEx && null != snappedIntoPlatformEy) {
thatPlayerInNextFrame.inAir = false;
if (fallStopping) {
thatPlayerInNextFrame.velY = 0; // shuts off the velocity component introduced by gravity, otherwise the character will slip down along a slope
thatPlayerInNextFrame.velY = 0;
thatPlayerInNextFrame.velX = 0;
thatPlayerInNextFrame.characterState = window.ATK_CHARACTER_STATE.Idle1[0];
thatPlayerInNextFrame.framesToRecover = 0;
}
const dotProd = thatPlayerInNextFrame.velX * snappedIntoPlatformEx + thatPlayerInNextFrame.velY * snappedIntoPlatformEy;
[thatPlayerInNextFrame.velX, thatPlayerInNextFrame.velY] = [dotProd * snappedIntoPlatformEx, dotProd * snappedIntoPlatformEy];
}
if (currPlayerDownsync.inAir != thatPlayerInNextFrame.inAir) {
thatPlayerInNextFrame.characterState = window.toInAirConjugate(thatPlayerInNextFrame.characterState);
}
}
// Get players out of stuck barriers if there's any