vsTASKER #4 – First Logic : Swarm of bees

In this video, you will learn how to create simple Logic to conduct various behaviors.
To understand what is a Logic, the better is to refer to the documentation. But to summarize, a Logic is made of one or several logical objects organized into a functional graph with states and transitions.
The first Logic displays “Hello World” on the console screen. It contains only one object.
The second Logic is a little more elaborated but with only two task objects, simulates a swarm of bees.
Some code is provided below the video to help you build this demo in vsTASKER.
The database can also be downloaded.

 
Bee Logic:

Wander Task Runtime

   float speed = RANDOM(10,30);
   float heading = RANDOM(-180,180);

   E:dyn->setSpeed(speed);
   E:dyn->setHeading(DEG2RAD(heading));

GoCenter Task Runtime

    WCoord center(0,0);
    E:dyn->setHeading(center);

    if (E:pos.distanceTo(center) < 50) return DONE;

 
Download the database (vsTASKER v6):

Download the zip database.
Unzip it in Data/Db/OpenGL
Load it with vsTASKER GUI v6 or newer