Browse Search Popular Register Upload Rules User list Login:
Search:
Method 1: The onClick handler of the circle updates a variable (a counter)in scene.my. The scoreboard "reads" that because it has {....} in its text attribute.

Method 2: The onClick handler of the circle updates its own counter. It also "writes" it to the scoreboard. To do that it needs the internal ref of the scoreboard. It can get that because the scoreboard writes it to scene.my. in its onSpawn handler (which is executed when the scene loads).

Method 3: The onClick handler of the circle updates its own counter. The scoreboard "reads" it from there. To do that it needs the internal ref of the circle. It can get that because the circle writes it to scene.my. in its onSpawn handler (which is executed when the scene loads).

As an alternative I could have obtained the internal ref of an entity (circle or scoreboard) by coding its geomID or entityID and calling either scene.entityByGeomID or scene.entityByID.

I am new to Algodoo and have found out most of this by trial and error.http://www.algodoo.com/algobox/theme/smilies/bonk.gif
So I have no idea when to use these methods. I was just showing what is possible. Method 1 is the easiest to understand and use.

I have seen other people call a function called "readable" and use an attribute(?) called "owner" when dealing with objects, but I have been unable to find out what they are. I would be grateful if anyone could tell me.
Thanks for that Xray. Silly me: I had been using Google searches without realising that the forum has its own.

I have read most of posts you indicated and found it interesting that you and other people have had exactly the same difficulties. I have also fallen into the trap of not realising that UNDO can remove code you have entered.

Thanks for your help.
Comment withdrawn.
Last edited at 2016/01/20 18:15:54 by griggy
Very nice, however the 3D effect would be better if the image were stretched the other way. For example, the view of a cylinder has an ellipse for its top with its long axis in the X direction, not the Y direction.
Best wishes.
I know this is months after original posting. I just want to point out that this seems to use the CENTRE of the objects - not the nearest edge. So, for example if one object is very big it can touch the laser but still not be the "nearest" object. I do not know how to find the object with the nearest edge.:)
Last edited at 2016/05/19 16:11:23 by griggy
Absolutely amazing. I have spent hours trying to see how it works! I found that the food had no attraction (or other "field") set, so how could the animal detect it? I wondered if you were tricking us (for fun). It was only by testing how attraction works that I solved the problem. As for how the animal moves and captures the food - incredible. _o_ _o_ _o_
Last edited at 2016/05/26 15:17:01 by griggy