View difference between Paste ID: wwQAqmiQ and b4EZxSVT
SHOW: | | - or go back to the newest paste.
1
	let explosiongraphic1 = CSD~"exp1.png";
2
	let explosiongraphic2 = CSD~"exp2.png";
3
	
4
	LoadGraphic(explosiongraphic1);
5
	LoadGraphic(explosiongraphic2);
6
	
7
    task explosion1(X,Y,Killtime,Startingsize,Maxsize){
8
    let explosion1 = Obj_Create(OBJ_EFFECT);
9
    let scaling = Startingsize;
10
	let fadeout = 255;
11
	let enlargespeed = 0.01;
12
	let deletetimer = 0;
13
14
    Obj_SetPosition(explosion1,X,Y);
15
    ObjEffect_SetRenderState(explosion1,ADD);
16
    ObjEffect_SetTexture(explosion1,explosiongraphic1);
17
    ObjEffect_SetLayer(explosion1,3);
18
    ObjEffect_SetScale(explosion1,scaling,scaling);
19
20
    ObjEffect_SetPrimitiveType(explosion1,PRIMITIVE_TRIANGLESTRIP);
21
    ObjEffect_CreateVertex(explosion1,4);    
22
23
    ObjEffect_SetVertexXY(explosion1,0,-128,-128);
24
	ObjEffect_SetVertexXY(explosion1,1,128,-128);
25
	ObjEffect_SetVertexXY(explosion1,2,-128,128);
26
	ObjEffect_SetVertexXY(explosion1,3,128,128);
27
28
    ObjEffect_SetVertexUV(explosion1,0,0,0);
29
	ObjEffect_SetVertexUV(explosion1,1,256,0);
30
	ObjEffect_SetVertexUV(explosion1,2,0,256);
31
	ObjEffect_SetVertexUV(explosion1,3,256,256);
32
	
33
	ascent(i in 0..4){
34
	ObjEffect_SetVertexColor(explosion1,i,fadeout,255,255,255);
35
	}
36
37
    while(!Obj_BeDeleted(explosion1)){
38
	deletetimer++;
39
	
40
    ascent(i in 0..4){
41
	ObjEffect_SetVertexColor(explosion1,i,fadeout,255,255,255);
42
	}
43
	
44
	ObjEffect_SetScale(explosion1,scaling,scaling);
45
	scaling+=enlargespeed;
46
	
47
	if(scaling>Maxsize && enlargespeed>0.0005){
48
	enlargespeed-=0.0005;}
49
	
50
	if(enlargespeed<0.0005){
51
	enlargespeed=0.0005;}
52
	
53
	if(deletetimer>Killtime && enlargespeed==0.0005 && fadeout>0){
54
	fadeout-=10;}
55
	
56-
	if(fadeout==0){
56+
	if(fadeout<=0){
57
	Obj_Delete(explosion1);}
58
	
59
    yield;
60
    }
61
    }
62
	
63
	task explosion2(X,Y,Killtime,Startingsize,Maxsize){
64
    let explosion2 = Obj_Create(OBJ_EFFECT);
65
    let scaling = Startingsize;
66
	let fadeout = 255;
67
	let enlargespeed = 0.01;
68
	let deletetimer = 0;
69
70
    Obj_SetPosition(explosion2,X,Y);
71
    ObjEffect_SetRenderState(explosion2,ADD);
72
    ObjEffect_SetTexture(explosion2,explosiongraphic2);
73
    ObjEffect_SetLayer(explosion2,4);
74
    ObjEffect_SetScale(explosion2,scaling,scaling);
75
76
    ObjEffect_SetPrimitiveType(explosion2,PRIMITIVE_TRIANGLESTRIP);
77
    ObjEffect_CreateVertex(explosion2,4);    
78
79
    ObjEffect_SetVertexXY(explosion2,0,-128,-128);
80
	ObjEffect_SetVertexXY(explosion2,1,128,-128);
81
	ObjEffect_SetVertexXY(explosion2,2,-128,128);
82
	ObjEffect_SetVertexXY(explosion2,3,128,128);
83
84
    ObjEffect_SetVertexUV(explosion2,0,0,0);
85
	ObjEffect_SetVertexUV(explosion2,1,256,0);
86
	ObjEffect_SetVertexUV(explosion2,2,0,256);
87
	ObjEffect_SetVertexUV(explosion2,3,256,256);
88
	
89
	ascent(i in 0..4){
90
	ObjEffect_SetVertexColor(explosion2,i,fadeout,255,0,0);
91
	}
92
	
93
94
    while(!Obj_BeDeleted(explosion2)){
95
	deletetimer++;
96
	
97
	ascent(i in 0..4){
98
	ObjEffect_SetVertexColor(explosion2,i,fadeout,255,0,0);
99
	}
100
	
101
	ObjEffect_SetScale(explosion2,scaling,scaling);
102
	scaling+=enlargespeed;
103
	
104
	if(scaling>Maxsize && enlargespeed>0.0005){
105
	enlargespeed-=0.0005;}
106
	
107
	if(enlargespeed<0.0005){
108
	enlargespeed=0.0005;}
109
	
110
	if(deletetimer>Killtime && enlargespeed==0.0005 && fadeout>0){
111
	fadeout-=10;}
112
	
113-
	if(fadeout==0){
113+
	if(fadeout<=0){
114
	Obj_Delete(explosion2);}
115
	
116
    yield;
117
    }
118
    }