Java Reference
In-Depth Information
Figure 2-9. Example 6, fire
Listing 2-11. Particle.fx (partial)
//New attributes, other attributes omitted.
public-init var direction = 270.0;
public-init var directionVariation = 10.0;
init{
//other code omitted.
var startingDirection = direction + Main.randomFromNegToPos(directionVariation);
var theta = Math.toRadians(startingDirection);//random.nextFloat()*2.0*Math.PI;
deltaX = Math.cos(theta)*speed;
deltaY = Math.sin(theta)*speed;
//other code omitted.
}
Search WWH ::




Custom Search