Commit f7a4f271 authored by wildfirecode's avatar wildfirecode

1

parent 48e34320
......@@ -18,13 +18,6 @@
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/other/RelativeLayout",
"properties": {
"top": 0,
"left": 0
}
}
],
"children": [
......@@ -43,6 +36,26 @@
}
],
"uuid": "fb53fa37-a942-4474-901a-582dccd14c93"
},
{
"name": "Label",
"components": [
{
"script": "components/base/Transform",
"properties": {}
},
{
"script": "components/renderer/TextRenderer",
"properties": {
"text": "1111",
"fillColor": "rgba(255, 255, 255, 1)",
"textStyle": {
"fontSize": 40
}
}
}
],
"uuid": "8abfc716-7017-4834-a7fa-5ca6c2ce4b3e"
}
]
}
......
......@@ -7,7 +7,7 @@
"script": "components/base/Transform"
},
{
script: 'components/other/CameraController'
"script": "components/other/CameraController"
},
],
"children": [
......
import { Component } from 'scilla/src';
import { Transform } from 'scilla-components/src';
export default class BallItem extends Component {
speed = 0;
onUpdate() {
const { entity } = this;
this.speed += 1.5;
entity.getComponent(Transform).position.y += this.speed;
}
}
\ No newline at end of file
{"ver":"1.0.1","uuid":"13d4186d-890e-49b1-81b5-904757056582","subMetas":{},"type":"script"}
......@@ -7,20 +7,36 @@ import { alien } from "../navigator/StackNavigator";
import { INavigatorViewBase } from "../navigator/VirtualNavigator";
import { Transform } from 'scilla-components/src';
const GROUND_Y = 250; //碰到地板时,球的中心点的y
export default class ScenePlay extends Component implements INavigatorViewBase {
BallItemPrefab: resource;
testPrefab: resource;
bulletNumTxt: Entity;
strengthNumTxt: Entity;
ballList: Entity[];
getBallItem() {
const ball = instantiate(this.BallItemPrefab);
this.entity.addChild(ball);
this.ballList.push(ball);
console.log(ball.getComponent(Transform).position.y);
}
onAwake() {
super.onAwake();
this.ballList = [];
}
onUpdate() {
// for (const ball of this.ballList) {
// ball.getComponent(Transform).position.y += 1;
// const y = ball.getComponent(Transform).position.y;
// console.log(ball.getComponent(Transform).position.y);
// if (y > GROUND_Y) {
// }
// }
}
onDidEnter(last: string, action: alien.NavigatorAction, parameters: any): void {
......
{"ver":"1.0.1","uuid":"d64549e1-a233-4e9f-83fd-225a57a7d5cd","subMetas":{},"type":"script"}
......@@ -6502,9 +6502,14 @@
ScenePlay.prototype.getBallItem = function () {
var ball = instantiate(this.BallItemPrefab);
this.entity.addChild(ball);
this.ballList.push(ball);
console.log(ball.getComponent(Transform).position.y);
};
ScenePlay.prototype.onAwake = function () {
_super.prototype.onAwake.call(this);
this.ballList = [];
};
ScenePlay.prototype.onUpdate = function () {
};
ScenePlay.prototype.onDidEnter = function (last, action, parameters) {
this.entity.getComponent(Transform).alpha = 1;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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