Java Reference
In-Depth Information
Figure 10-2. Two types of particles
The bigger ones try to capture the sense of smoke and fire at the point where the sparks are being
emitted, and the little particles try to capture the sense of sparks falling and bouncing. Listing 10-1
shows the majority of the Main.fx file for this example.
Listing 10-1. Main.fx
public var cloud = Image{
url: "{__DIR__}cloud.png"
}
public var spark = Image{
url: "{__DIR__}spark.png"
}
public var random = new Random();
var worldNodes:WorldNode[];
var emitters:Emitter[];
var particles = Group{
blendMode: BlendMode.ADD
}
var obstacles = Group{}
var world = new World(new Vector2f(0,600), 1);
var worldUpdater = Timeline{
repeatCount: Timeline.INDEFINITE
keyFrames: KeyFrame{
time: 1.0/30.0*1s
action: update;
}
}
public function update():Void{
world.<<step>>();
Search WWH ::




Custom Search