1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

ant - image

Posted by Karel Verh on Nov 15, 2010

Dear,
I just started learning this great software..
I want to customize the ant (library - system - ants) script, by replacing the ants and food, by a self created image.

How can I do that?
Is it possible to let the ant-image turn in the direction of the food?

thank you!


 
Posted by Lucas on Nov 16, 2010

Hello Karel,
If you study the code you will see at the end of the ant file:

oval(ant.x-4,ant.y-4,3,3)
Replace this e.g. with:
text("a",ant.x,ant.y)
and you will see where the ant is drawn and that you can replace it with anything you like.
Making it turn into the right direction is a matter of adding a direction to it and is certainly possible. You just need some math skills to do that. It is even on the NodeBox site:
http://nodebox.net/code/index.php/Math

good luck,

Lucas



Posted by karel on Nov 24, 2010

thank you!