summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c
diff options
context:
space:
mode:
Diffstat (limited to 'TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c')
-rw-r--r--TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c b/TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c
new file mode 100644
index 0000000..4a70dd2
--- /dev/null
+++ b/TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c
@@ -0,0 +1,29 @@
+/*-- Brick --*/
+
+#strict 2
+
+local yMin, yMax;
+
+protected func Initialize()
+{
+ SetAction("Flying");
+ SetPhase(Random(2));
+ SetDir(Random(2));
+ ContactTop();
+ yMin = 100;
+ yMax = 650;
+}
+
+protected func ContactBottom() { SetYDir(-10); }
+protected func ContactTop() { SetYDir(10); }
+
+func CheckHit()
+{
+ if (GetXDir() == 0 && GetYDir() == 0)
+ {
+ SetXDir(RandomX(-100, 100));
+ SetYDir(RandomX(-100, 100));
+ }
+ if (GetY() >= yMax) ContactBottom();
+ if (GetY() <= yMin) ContactTop();
+}