Forum

> > CS2D > Scripts > spawn image on entities
Forums overviewCS2D overview Scripts overviewLog in to reply

English spawn image on entities

No replies
To the start Previous 1 Next To the start

old spawn image on entities

massiveguy
User Off Offline

Quote
well, i'm just helping someone but i don't know how to
spawn image over entities which named "walls"
i have no idea how to set images over entities..
this is just make dissolve effect when player walkover entities which named "fadeout"

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
addhook("movetile","yesthis")
addhook("join","_cave")
addhook("startround","donotremove")
addhook("spawn","_cai")
addhook("die","fadecave")


function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end

cavei = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
caveii = initArray(32)




function _cai(id)
freeimage(caveii[id])
caveii[id] = image("gfx/stone.png",0,1,1,id)
imagepos(caveii[id],16,16,0)
cavei[id]=0
end

function donotremove()
for id = 1,32 do
caveii[id] = image("gfx/stone.png",0,1,1,id)
imagepos(caveii[id],16,16,0)
end
end

function _cave(id)
caveii[id] = image("gfx/stone.png",0,1,1,id)
imagepos(caveii[id],16,16,0)
end

function fadecave(id)
tween_alpha(caveii[id],500,1.0) 
end

function yesthis(id,x,y)
if entity(x,y,'name')== "fadeout" and cavei[id]==0 then
tween_alpha(caveii[id],500,0.3)
cavei[id]=1
end
if entity(x,y,"name")== "fadein" and cavei[id]==1 then
tween_alpha(caveii[id],500,1.0) 
cavei[id]=0
end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview