Thing
for the world of ThingThingThingYou will be editing your Thing
class down below in the editor.
Dont be scaried by the look, it is very strighforward.
When you are finished, just click the submit button.
A few basic syntax stuff to keep in mind while coding:
;
means the end of line. you need it at the end of every line.{
or }
Do not add or delete any of it. Anything
between a opening curly bracket and a close curly backet is a code block.//
: any text starts with a //
means all text after
//
is a comment, meaning those text would be ignore by the machine and only visible to humans.
There are some sample code with //
in front of them, you can delete the //
so you dont
have to type the code by youself.variables can be assigned directly using =
for example:
speed = 1.1
decimals(float):
please respect the range, or it might break the simulation. Remember, case-sensitive.
meshIndex
// an integer, which 3D model to use. range: 0 - 43speed
// how fast it can move: range 0-20cohesion
// how likely it will move towards other things 0 - 10seperation
// how likely it will move away from other things 0 - 10vertexCount
// how many vertices this Thing has at this moment: range 3-100width
// range 1-5height
// range 1-5depth
// range 1-5red
// range 0-1green
// range 0-1blue
// range 0-1spikyness
// range 0-1all variable assignment needs to go into the Init()
function code block.
Functions are actions your Thing can perform. It usually is something your Thing does to another Thing. Every
function needs a parameter. Parameter is the word inside parathesis. In our case, the prameters is probably
called other
a function is called like this: Clone(other);
DO NOT forget to add the ;
at the end of
each function call.
available functions:
Clone(other)
: create a copy of the other Thing you meetErase(other)
: delete the other Thing you meetSteal(other)
: steal vertices of the other Thing you meetGift(other)
: give vertices of your to the other Thing you meetSeek(other)
: start chasing the other Thing you meet (stop chasing automatically in 5 seconds)
All functions need to be placed inside a code block ( aka between {
and }
)
In our case, all functions need to be placed inside two event blocks:
IntervalAction
: functions placed here will be executated every 5 seconds;public override void IntervalAction(Thing other)
{
//call your functions here.
//example:
//Clone(other);
}
OnTouch
event: functions placed here will be executed when your Thing bump into other Things:public override void OnTouch(Thing other)
{
//call your functions here.
//example:
//Erase(other);
}