File: monster1_timer.txt

package info (click to toggle)
nikwi 0.0.20120213-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 8,628 kB
  • ctags: 1,246
  • sloc: cpp: 7,111; ansic: 880; objc: 247; makefile: 142; sh: 48
file content (29 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (6)
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
#
# Timer code for monster 1
#

Object	obj = getThisObject();
int	pos = getObjectVar(obj, 0);
int	inter = 300;

if (getLevel() < 5)
	inter = 700;

setObjectYMovement(obj, sin(itof(pos)*0.02)*0.3);

setObjectVar(obj, 0, pos + 15);

if (pos % inter == 0)
{
	int	objx = getObjectXPosition(obj);
	int	herox = getObjectXPosition(getHero());
	if (absi(objx - herox) < 20)
	{
		Object	green = createObject(makeCode("grn1"), objx + 10,
			getObjectYPosition(obj)+30);
		createMotionController(green);
		setObjectGravity(green, 0.2);
		playSample(makeCode("fart"));
	}
}