Welcome to StackOverflow and congratulations on a very detailed first question.
If your agents are initialized correctly, there is just one point you are missing. On the CarSource
block, when you go into Initial Speed
you will see a lightbulb on the left side of the text control. This lightbulb shows you any special variables available in that context.
In this case, you have self
(which points on the block itself) and car
, which points to the instance of car being created. If you want to use this information, you could set the initial speed for example to car.velocidadeEmergencia()
- which will call the function on each instance.
Again, it is very important in this case that the agents (cars) are initialized correctly. In this case, it is correct since the modoEmergencia
variable has an initial value.