42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
PassiveObjectFunction.PassiveObject_Create_5 <- function(parent_obj) {
|
|
local MyPos = GetPosition();
|
|
local AniObj = Animation("passiveobject/mapobject/particlefactory/animation/rayground.ani");
|
|
|
|
local Pos = {
|
|
x = MathClass.Rand(115, 185) + GetPosition().x,
|
|
y = MathClass.Rand(150, 190)
|
|
}
|
|
AniObj.SetPosition(Pos);
|
|
AniObj.SetUpdateFunc(function(dt) {
|
|
if (!("MoveFlag" in Var)) Var.MoveFlag <- false;
|
|
if (!("BasePos" in Var)) Var.BasePos <- GetPosition();
|
|
if (!("TimeFlag" in Var)) Var.TimeFlag <- 0;
|
|
|
|
Var.TimeFlag += dt;
|
|
if (Var.TimeFlag >= 3000) {
|
|
Var.TimeFlag = 0;
|
|
Var.MoveFlag = !Var.MoveFlag;
|
|
}
|
|
|
|
local XpoxMoveValue = 0;
|
|
if (!Var.MoveFlag) {
|
|
XpoxMoveValue = (ExistingTime.tofloat() % 3000.0);
|
|
} else {
|
|
XpoxMoveValue = ((3000.0 - (ExistingTime.tofloat() % 3000.0)));
|
|
}
|
|
XpoxMoveValue /= 400.0;
|
|
// print(XpoxMoveValue);
|
|
SetPosition(Var.BasePos.x + XpoxMoveValue, Var.BasePos.y);
|
|
})
|
|
Addchild(AniObj);
|
|
}
|
|
|
|
PassiveObjectFunction.PassiveObject_Proc_5 <- function(dt) {
|
|
|
|
}
|
|
|
|
PassiveObjectFunction.PassiveObject_Destroy_5 <- function(parent_obj) {
|
|
// print("我在场上");
|
|
// obj.RemoveSelf();
|
|
|
|
} |