summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/Misc.c4d/Brick.c4d/Script.c
blob: 4a70dd26646e201126786923b2267d57feb2caad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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(); 
}