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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
static_sfx=loadsfx('$MISSION/static.wav')
catch_sfx=loadsfx('$MISSION/seek.wav')
flashlight_gfx=loadgfx('$MISSION/flashlight.png')
setmidhandle(flashlight_gfx)
light_gfx=loadgfx('$MISSION/light.png')
sethandle(light_gfx,111,190)
dark_gfx=loadgfx('$MISSION/dot.png')
static_gfx={}
static_gfx[0]=loadgfx('$MISSION/static0.png')
static_gfx[1]=loadgfx('$MISSION/static1.png')
static_gfx[2]=loadgfx('$MISSION/static2.png')
static_gfx[3]=loadgfx('$MISSION/static3.png')
static_alpha=0
function mission_start()
	createobject(zj.slenderman.id,getnodex("slendy"),getnodey("slendy"))
end
function mission_draw()
	if getplayeraction(0)==0 then
		setblend(blend_alpha)
		setalpha(1)
		setcolor(255,255,255)
		drawinhand(flashlight_gfx,6,0,0.75)
	end
	setblend(blend_alpha)
	setscale(screenwidth()*50,screenheight()*50)
	setalpha(0.95)
	setcolor(0,0,0)
	setrotation(0)
	drawimage(dark_gfx,getplayerx(0)-(screenwidth()*25),getplayery(0)-(screenheight()*25))
	if getplayeraction(0)==0 then
		if weapon_mode==0 then
			setblend(blend_light)
			setalpha(0.5)
			setcolor(255,255,255)
			drawinhand(light_gfx,6,0,1)
		end
	end
	if static_alpha>0 then
		setblend(blend_alpha)
		setscale((1/800)*screenwidth(),(1/600)*screenheight())
		setalpha(static_alpha)
		setcolor(255,255,255)
		setrotation(0)
		drawhud(static_gfx[math.random(0,3)],0,0,1)
	end
end
function mission_update()
end
function static_blend()
	cutscene()
	static_alpha=static_alpha+0.01
	if static_alpha>=1.0 then
		static_kill()
	end
end
function static_kill()
	playerheal(0,2147483648)
end
if zj==nil then zj={} end
zj.slenderman={}
zj.slenderman.gfx={}
zj.slenderman.gfx[0]=loadgfx('$MISSION/slenderman0.png')
setmidhandle(zj.slenderman.gfx[0])
zj.slenderman.gfx[1]=loadgfx('$MISSION/slenderman1.png')
setmidhandle(zj.slenderman.gfx[1])
zj.slenderman.gfx[2]=loadgfx('$MISSION/slenderman2.png')
setmidhandle(zj.slenderman.gfx[2])
zj.slenderman.id=addobject("zj.slenderman",zj.slenderman.gfx[0])
function zj.slenderman.setup(id,parameter)
	if objects==nil then objects={} end
	objects[id]={}
	objects[id].sy=0
	objects[id].frame=0
	objects[id].frametimer=10
	objects[id].move=1
	objects[id].timer=100
end
function zj.slenderman.draw(id,x,y)
	setblend(blend_alpha)
	if math.sqrt((x-getplayerx(0))^2+(y-getplayery(0))^2)<80 and (getplayery(0)-8<y and getplayery(0)+8>y) and (getplayerx(0)<x and getplayerdirection(0)==1) or (getplayerx(0)>x and getplayerdirection(0)==-1) then
		setalpha(1)
	else
		setalpha(0)
	end
	setcolor(255,255,255)
	setrotation(0)
	if getplayerx(0)>=x then
		setscale(1,1.1)
	elseif getplayerhealth(0)>0 then
		setscale(-1,1.1)
	else
		setscale(1,1.1)
	end
	if math.abs(objects[id].sy)>1.5 then
		drawimage(zj.slenderman.gfx[2],x,y-3)
	elseif (collision(colplayer,x+1,y,1,1,1,-1,id)==0 or collision(colplayer,x-1,y,1,1,1,-1,id)==0 or collision(colplayer,x+1,y-1,1,1,1,-1,id)==0 or collision(colplayer,x-1,y-1,1,1,1,-1,id)==0 or collision(colplayer,x+1,y-2,1,1,1,-1,id)==0 or collision(colplayer,x-1,y-2,1,1,1,-1,id)==0 or collision(colplayer,x+1,y-3,1,1,1,-1,id)==0 or collision(colplayer,x-1,y-3,1,1,1,-1,id)==0) and (getplayerhealth(0)>0) and (objects[id].move==1) then
		if math.abs(getplayerx(0)-x)>2 then
			drawimage(zj.slenderman.gfx[objects[id].frame],x,y-3)
		else
			drawimage(zj.slenderman.gfx[2],x,y-3)
		end
	else
		drawimage(zj.slenderman.gfx[0],x,y-3)
	end
end
function zj.slenderman.update(id,x,y)
--	if (x<=getplayerx(0)-(screenwidth()/2) or x>=getplayerx(0)+(screenwidth()/2)) or (y<=getplayery(0)-(screenheight()/2) or y>=getplayery(0)+(screenheight()/2)) then
		if collision(colplayer,getplayerx(0)-(30*getplayerdirection(0)),getplayery(0),1,1,1,-1,id)==0 then
			x=getplayerx(0)-(30*getplayerdirection(0))
			y=getplayery(0)
		end
--	end
	objectposition(id,x,y)
	objects[id].move=1
	if math.sqrt((x-getplayerx(0))^2+(y-getplayery(0))^2)<80 and (getplayery(0)-10<y and getplayery(0)+10>y) then
		objects[id].move=0
		if (getplayerx(0)<x and getplayerdirection(0)==1) or (getplayerx(0)>x and getplayerdirection(0)==-1) then
			objects[id].timer=objects[id].timer-1
			objects[id].move=0
			if objects[id].timer<=0 then
				static_blend()
			end
			if objects[id].timer==0 then
				playsound(static_sfx,-1,1.5)
			end
			if objects[id].timer==99 then
				playsound(catch_sfx,-1,1.5)
			end
		end
	else
		objects[id].timer=100
	end
end
function zj.slenderman.damage(id,damage)
end