This commit is contained in:
2024-08-23 13:26:26 +08:00
parent 75f0677b88
commit 97875dfe2b
10 changed files with 286 additions and 43 deletions

View File

@@ -601,13 +601,13 @@
"_restitution": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": -386.5
"x": 1.9,
"y": -400.1
},
"_size": {
"__type__": "cc.Size",
"width": 3182.4,
"height": 827
"width": 3178.5,
"height": 799.8
},
"_id": ""
},
@@ -624,8 +624,6 @@
"__id__": 0
},
"fileId": "9eQ9Op13lL5ZqF+H2E1cEl",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{

View File

@@ -15,9 +15,9 @@
<key>spriteSourceSize</key>
<string>{96,96}</string>
<key>textureRect</key>
<string>{{96,1},{80,96}}</string>
<string>{{1,678},{80,96}}</string>
<key>textureRotated</key>
<false/>
<true/>
</dict>
<key>atk1_07.png</key>
<dict>
@@ -30,9 +30,69 @@
<key>spriteSourceSize</key>
<string>{96,93}</string>
<key>textureRect</key>
<string>{{1,1},{96,93}}</string>
<string>{{1,583},{96,93}}</string>
<key>textureRotated</key>
<true/>
<false/>
</dict>
<key>guard_trailing_0-12.png</key>
<dict>
<key>aliases</key>
<array/>
<key>spriteOffset</key>
<string>{0,0}</string>
<key>spriteSize</key>
<string>{97,143}</string>
<key>spriteSourceSize</key>
<string>{97,143}</string>
<key>textureRect</key>
<string>{{1,295},{97,143}}</string>
<key>textureRotated</key>
<false/>
</dict>
<key>guard_trailing_0-17.png</key>
<dict>
<key>aliases</key>
<array/>
<key>spriteOffset</key>
<string>{0,0}</string>
<key>spriteSize</key>
<string>{98,141}</string>
<key>spriteSourceSize</key>
<string>{98,141}</string>
<key>textureRect</key>
<string>{{1,1},{98,141}}</string>
<key>textureRotated</key>
<false/>
</dict>
<key>guard_trailing_0-18.png</key>
<dict>
<key>aliases</key>
<array/>
<key>spriteOffset</key>
<string>{0,0}</string>
<key>spriteSize</key>
<string>{97,141}</string>
<key>spriteSourceSize</key>
<string>{97,141}</string>
<key>textureRect</key>
<string>{{1,440},{97,141}}</string>
<key>textureRotated</key>
<false/>
</dict>
<key>guard_trailing_0-8.png</key>
<dict>
<key>aliases</key>
<array/>
<key>spriteOffset</key>
<string>{0,0}</string>
<key>spriteSize</key>
<string>{97,149}</string>
<key>spriteSourceSize</key>
<string>{97,149}</string>
<key>textureRect</key>
<string>{{1,144},{97,149}}</string>
<key>textureRotated</key>
<false/>
</dict>
</dict>
<key>metadata</key>
@@ -46,9 +106,9 @@
<key>realTextureFileName</key>
<string>atk.png</string>
<key>size</key>
<string>{177,98}</string>
<string>{100,759}</string>
<key>smartupdate</key>
<string>$TexturePacker:SmartUpdate:921ca90a772281d8370d52dcd03d69bb:e98751142a1edb6198b7f9d055c0661a:161bb8e8e5d13d624c660b9bcb3183a7$</string>
<string>$TexturePacker:SmartUpdate:dedc4bfaabc2009a0f55fa94882d533b:ccd331208d7352b4c4126d7e1102f82e:161bb8e8e5d13d624c660b9bcb3183a7$</string>
<key>textureFileName</key>
<string>atk.png</string>
</dict>

View File

@@ -7,6 +7,52 @@
".json"
],
"subMetas": {
"85462": {
"importer": "sprite-frame",
"uuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a@85462",
"displayName": "",
"id": "85462",
"name": "guard_trailing_0-18",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 440,
"width": 97,
"height": 141,
"rawWidth": 97,
"rawHeight": 141,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "080612ff-048b-45e7-b7d1-383a7fa73063@6c48a",
"atlasUuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"41d52": {
"importer": "sprite-frame",
"uuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a@41d52",
@@ -16,11 +62,11 @@
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"rotated": true,
"offsetX": 0,
"offsetY": 0,
"trimX": 96,
"trimY": 1,
"trimX": 1,
"trimY": 678,
"width": 80,
"height": 96,
"rawWidth": 96,
@@ -62,11 +108,11 @@
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": true,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"trimY": 583,
"width": 96,
"height": 93,
"rawWidth": 96,
@@ -98,6 +144,144 @@
".json"
],
"subMetas": {}
},
"5e00d": {
"importer": "sprite-frame",
"uuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a@5e00d",
"displayName": "",
"id": "5e00d",
"name": "guard_trailing_0-12",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 295,
"width": 97,
"height": 143,
"rawWidth": 97,
"rawHeight": 143,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "080612ff-048b-45e7-b7d1-383a7fa73063@6c48a",
"atlasUuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"1573b": {
"importer": "sprite-frame",
"uuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a@1573b",
"displayName": "",
"id": "1573b",
"name": "guard_trailing_0-17",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 1,
"width": 98,
"height": 141,
"rawWidth": 98,
"rawHeight": 141,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "080612ff-048b-45e7-b7d1-383a7fa73063@6c48a",
"atlasUuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"104fb": {
"importer": "sprite-frame",
"uuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a@104fb",
"displayName": "",
"id": "104fb",
"name": "guard_trailing_0-8",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 1,
"trimY": 144,
"width": 97,
"height": 149,
"rawWidth": 97,
"rawHeight": 149,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [],
"indexes": [],
"uv": [],
"nuv": [],
"minPos": [],
"maxPos": []
},
"isUuid": true,
"imageUuidOrDatabaseUri": "080612ff-048b-45e7-b7d1-383a7fa73063@6c48a",
"atlasUuid": "2e21a159-09af-47d0-b8f3-92f814f4a38a"
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -108,8 +108,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": -0.5,
"y": 0.5,
"z": 1
},
"_mobility": 0,
@@ -136,8 +136,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 80,
"height": 96
"width": 97,
"height": 143
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -173,7 +173,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "2e21a159-09af-47d0-b8f3-92f814f4a38a@41d52",
"__uuid__": "2e21a159-09af-47d0-b8f3-92f814f4a38a@5e00d",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
@@ -188,7 +188,10 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_atlas": {
"__uuid__": "2e21a159-09af-47d0-b8f3-92f814f4a38a",
"__expectedType__": "cc.SpriteAtlas"
},
"_id": ""
},
{

View File

@@ -108,8 +108,8 @@
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"x": -0.5,
"y": 0.5,
"z": 1
},
"_mobility": 0,
@@ -136,8 +136,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 96,
"height": 93
"width": 97,
"height": 149
},
"_anchorPoint": {
"__type__": "cc.Vec2",
@@ -173,7 +173,7 @@
"a": 255
},
"_spriteFrame": {
"__uuid__": "2e21a159-09af-47d0-b8f3-92f814f4a38a@b3fb8",
"__uuid__": "2e21a159-09af-47d0-b8f3-92f814f4a38a@104fb",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,

View File

@@ -34,17 +34,16 @@ export class Role extends ecs.Entity {
}
/** 加载角色 */
load(pos: Vec3 = Vec3.ZERO,scale:number = 1,uuid:number=101) {
load(uuid:number=101) {
// var path = "game/monster/"+prefab_path;
var path = "game/heros/role";
let pos: Vec3 = Vec3.ZERO
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
var scene = smc.map.MapView.scene;
node.parent = scene.entityLayer!.node!;
// var as = node.getComponent(MonsterSpine);
node.getChildByName("avatar").setScale(node.getChildByName("avatar").scale.x*scale, node.getChildByName("avatar").scale.y, node.getChildByName("avatar").scale.z);
node.setPosition(pos)
// console.log(node.getChildByName("avatar").getChildByName("TNode").getChildByName("bb").getComponent(Sprite))
const url = 'game/heros/player';

View File

@@ -43,7 +43,7 @@ export class MapViewComp extends CCComp {
}
load_role(){
let role = ecs.getEntity<Role>(Role);
role.load()
role.load(103)
}
load_data(){
// let heros = oops.res.get("config/game/heros")

View File

@@ -123,12 +123,10 @@ export class MonsterViewComp extends CCComp {
}
onPreSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE){
if(selfCollider.group != otherCollider.group&&otherCollider.tag != BoxSet.ATK_RANGE&&otherCollider.tag != BoxSet.SKILL_TAG){
this.is_atking = true;
if(otherCollider.tag != BoxSet.SKILL_TAG&&selfCollider.tag != BoxSet.ATK_RANGE){
this.stop_cd = 0.1;
}
}
}
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
@@ -213,8 +211,8 @@ export class MonsterViewComp extends CCComp {
shoot(skill_uuid:number){
// console.log("monster shoot");
let skill = ecs.getEntity<Skill>(Skill);
let x=0
let pos = v3(x,40)
let x=32
let pos = v3(this.scale*32,30)
let speed =SkillSet[skill_uuid].speed;
let scale = this.scale
let dis = SkillSet[skill_uuid].dis;

View File

@@ -37,7 +37,8 @@ export class SkillCom extends CCComp {
collider.tag = this.box_tag;
collider.sensor = true;
if (collider) {
collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.BEGIN_CONTACT, this.onBeginContact, this);
// collider.on(Contact2DType.END_CONTACT, this.onEndContact, this);
collider.on(Contact2DType.POST_SOLVE, this.onPostSolve, this);
}
if(this.t_pos){
@@ -66,9 +67,9 @@ export class SkillCom extends CCComp {
}
}
onEndContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(otherCollider.group != selfCollider.group){
// console.log("skill end contact",selfCollider.group,otherCollider.group)
onBeginContact (selfCollider: Collider2D, otherCollider: Collider2D, contact: IPhysics2DContact | null) {
if(otherCollider.group != selfCollider.group&&otherCollider.tag !=BoxSet.ATK_RANGE&&otherCollider.tag !=BoxSet.SKILL_TAG){
// console.log("skill onBeginContact",selfCollider.group,otherCollider.group)
this.is_destroy=true
}
}