

This is usually used when using the addObject commands to prevent editing both the attributes of the newly created shape AND the object executing the object (i.e. Note: Writing := instead of = ensures that a variable is created instead of writing to a variable in a larger scope. Anywhere outside the brackets that contain the variable is inaccessible.
#ALGODOO CAR DESTRUCTION CODE#
The scope is the code inside the brackets in which the variable is located. Temporary variables are created without any object specification, and only last within the current scope.

Only return causes the current edits to apply, eventually resetting it when errors exist.Ī user can use custom variables, which can either be permanent or temporary.Ĭreates a new variable called "_foo" if not already created and assigns the number 45 to it.Īll permanent custom variables need an underscore (or the "_" symbol) at the beginning of the variable name to identify that it should be saved as part of the object.Ĭreates a variable called "bar" that lasts until the current scope ends, and assigns the geometry ID of the "other" object (available in onCollide) to it. Visually forcing a new line in a script window requires to press shift+return or control+return. Note: After each command line, a colon needs to be added to mark the end of a command line, unless there is a closing bracket. = e.pos - assigning the position at which the event occured to the variable, ending the command with an Pos - using the pos variable, which is responsible for the position of an object Referring to the data that was collected at the beginning of the event There are two ways of using variables inside of objects.Ī user can use an already existing variable, which is used for certain attributes of your current object.Į.
#ALGODOO CAR DESTRUCTION FULL#
You can find a full list of property variables here. An example is, which is the name of the variable storing the position of the camera. Using a properties variable of the current scene requires the user to know the name of the variable. Loading a scene will load any assigned global variable with its last value. Writing variables properly will make sure that your Algodoo scenes using Thyme will work.Īny assigned scene.my variable (example: scene.my.theNumber) will be saved in the scene. Note: Writing variables incorrectly will result in the variable being a temporary variable instead of a permanent variable. The variable can either be a global variable, which has properties for the entire scene (written as scene.my.nameHere), or an local object variable, stored inside an object (written as _nameHere). Using Thyme to do anything meaningful requires a simple syntax basing on variable manipulation:
#ALGODOO CAR DESTRUCTION UPDATE#
update - Like postStep, but it triggers every time, even when the simulation is not running.postStep - Triggers while the simulation is running according to the HZ level of the simulation.Without further scripting, this will trigger no matter what key it was.


