Editor documentation

Blob objects feature the Blob.velocity property. Basically, it’s a Vector instance that defines their movement per second.

It may be manipulated either via Vector.x and Vector.y properties to directly set the movement per second on X & Y axis respectively or via Vector.mag and Vector.dir to manipulate the speed and direction angle instead. In the latter case, Blob.speed and Blob.dir properties are provided as aliases to simplify the code.

Note that when you modify the vector attached to velocity, even if it’s assigned to its own variable, it will still affect the blob. In cases when this is undesired, you may call blob.velocity.clone() to instead get a cloned vector that may be modified without affecting the blob. For example:

// this will make the blob move faster
blob.velocity.mag = blob.velocity + 10

// this will make the blob move faster
let velocity = blob.velocity
velocity.mag = velocity + 10

// this will NOT make the blob move faster
let velocity = blob.velocity.clone()
velocity.mag = velocity + 10