Commit 53d09435 authored by 智慧's avatar 智慧

feat:随机生成敌机坐标

parent ad7ed5bd
......@@ -777,7 +777,7 @@
},
{
"__type__": "cc.Node",
"_name": "enemy",
"_name": "enemyManager",
"_objFlags": 0,
"_parent": {
"__id__": 1
......@@ -787,12 +787,6 @@
"_components": [
{
"__id__": 21
},
{
"__id__": 22
},
{
"__id__": 23
}
],
"_prefab": null,
......@@ -806,8 +800,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 51,
"height": 38
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -841,69 +835,19 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "5cdVHfYv9H8IDA7WFeGcrZ"
"_id": "e0xutPt5NAa7v9YNOOp+Lg"
},
{
"__type__": "cc.Sprite",
"__type__": "c8b4aZ/YolJe6S3VI9U49K3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "5c693fcc-43f6-4f16-b3b7-55672662654a"
"enemyPre": {
"__uuid__": "2d5bd71d-83bc-495b-b587-33b5cf01281b"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "572uE6ztZLIYUz2tX5toAL"
},
{
"__type__": "cc.BoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"tag": 1,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 1.9
},
"_size": {
"__type__": "cc.Size",
"width": 43.4,
"height": 32.3
},
"_id": "240JwdjLVGvLFBHWtOcYww"
},
{
"__type__": "e4cffTABZpCL58N/un/x4eE",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"_id": "4aLf5u87xPfJogtnzuJXnP"
"_id": "3duspBSzBGLJD3AvOCutAq"
}
]
\ No newline at end of file
const {ccclass, property} = cc._decorator;
@ccclass
export default class EnemyManager extends cc.Component {
//敌机预设体
@property(cc.Prefab)
enemyPre : cc.Prefab = null;
start () {
this.schedule(() => {
let enemy = cc.instantiate(this.enemyPre);
enemy.setParent(cc.director.getScene());
enemy.y = this.node.y;
enemy.x = Math.random() * 324 + 20;
}, 2);
//实例化预设体
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "c8b4a67f-6289-497b-a4b7-548f54e3d2b7",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": 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": "enemy",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
},
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 51,
"height": 38
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
152.312,
683.293,
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__": "5c693fcc-43f6-4f16-b3b7-55672662654a"
},
"_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.BoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"tag": 1,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 1.9
},
"_size": {
"__type__": "cc.Size",
"width": 43.4,
"height": 32.3
},
"_id": ""
},
{
"__type__": "e4cffTABZpCL58N/un/x4eE",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "2d5bd71d-83bc-495b-b587-33b5cf01281b",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"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