-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexplosion.CB
60 lines (50 loc) · 1.38 KB
/
explosion.CB
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
InitSparks:
Type SPARKS
Field x As Float
Field y As Float
Field v As Float
Field a As Float
Field f As Float
Field s As Float
EndType
Return
CalcSparks:
If isku2<>wisku2 Then
Explosion(Rand(sw),Rand(sh))
c# = 255
Else
c# = smooth(0,c,20)
EndIf
For spark.SPARKS = Each SPARKS
spark\x = spark\x + Cos(spark\a)*spark\v
spark\y = spark\y - Sin(spark\a)*spark\v
If spark\s>0 Then spark\s = spark\s - 0.5
If spark\x<0 Or spark\x>sw Then del_spark = 1
If (spark\y<0 Or spark\y>sh) Or del_spark Then
Delete spark
del_spark = 0
EndIf
Next spark
Return
DrawSparks:
cbeSetBlendMode(CBE_BLEND_ADDITIVE)
For spark.SPARKS = Each SPARKS
'For w# = 1 To RoundUp(Sqrt(swra#^2+shra#^2))
' Line spark\x+w,spark\y+w, spark\x+Cos(spark\a)*24+w,spark\y-Sin(spark\a)*24+w
'Next w#
cbeColor(0,c#,255,50)
Box spark\x-spark\s/2, spark\y-spark\s/2, spark\s*swra, spark\s*shra
'sc = 1 + (s / 100)
'cbeTriangle(spark\x + 14 * Cos(runTime) * swra, spark\y, spark\x + 16 * sc * swra, spark\y + 6 * sc + 10 * Sin(runTime) * shra, spark\x - 8 * sc * swra, spark\y + 13 * sc * shra, 2, ON)
Next spark
Return
Function Explosion(x,y)
For i = 0 To 359
spark.SPARKS = New(SPARKS)
spark\x = x
spark\y = y
spark\v = Rnd(0.5,3)
spark\a = i
spark\s = 96
Next i
EndFunction