The method to emit explosion particles works in a similar way to the one that emits smoke.
SpawnExplosion
in the game
class. The parameters are the x
and y
positions, and the amount of particles to create.Method SpawnExplosion:Int(x:Float, y:Float, amount:Int)
eng.SetDefaultLayer(layerGame)
i
variable ranging from 1
to the amount
parameter of the method.For Local i:Int = 1 To amount
x
offset that is used when an image object for the explosion particle is created.Local xoff:Float = Int(Rnd(0,3))
Local obj:=eng.CreateImage(atlas,144+xoff*16.0,80,16,16, x,y)
10
to 40
pixels and at a random angle around the given coordinates of the method.Local vec:Float[] = obj.GetVector(Rnd(10,40),Rnd(360))
1000
to 3000
milliseconds. The transition ID will be set to triDelete
.Local trans:ftTrans = obj.CreateTransPos(vec[0], vec[1], Rnd(1000,3000), False, triDelete)
0.1
to 1.0
.obj.SetScale(Rnd(0.1,1.0))
2.0
to 4.0
.obj.AddTransScale(trans, Rnd(2.0,4.0), False)
0.5
.obj.AddTransAlpha(trans, 0.5, False)
Next Return 0 End
18.216.239.46