Browse Search Popular Register Upload Rules User list Login:
Search:
Autonomous ant with basic AI

Image:
screenshot of the scene

Author: rorziz

Group: Default

Filesize: 48.55 kB

Date added: 2017-04-14

Rating: 5

Downloads: 1182

Views: 319

Comments: 9

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Kia ora,

So very basic intelligence, but the ant will walk around looking for food, changing direction when it hits a wall, when it sees food (the circles) it will turn towards it and speed up to eat it!

once eaten, the food will respawn in a random location;

loads of thanks to xray for the help with the local variables!
Last edited at 2017/04/15 22:15:16 by rorziz
Please log in to rate this scene
edit
Similar scenes
Title: Autonomous Vehicle Competition
Rating: 5
Filesize: 37.06 kB
Downloads: 296
Comments: 0
Ratings: 1
Date added: 2009/05/14 22:08:02
Made with: Phun
Rating: rated 5
download
Title: Re:Autonomous Vehicle Contest ( fixed )
Rating: 5
Filesize: 58.21 kB
Downloads: 393
Comments: 0
Ratings: 1
Date added: 2009/05/15 15:55:06
Made with: Phun
Rating: rated 5
download
Title: BotBash
Rating: 5
Filesize: 157.02 kB
Downloads: 919
Comments: 0
Ratings: 1
Date added: 2013/12/18 20:31:30
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Basic destroyable building
Rating: 5
Filesize: 99.56 kB
Downloads: 9037
Comments: 0
Ratings: 1
Date added: 2014/11/10 04:03:06
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Basic Semi-Auto Gun
Rating: 6.3
Filesize: 45.62 kB
Downloads: 2346
Comments: 1
Ratings: 4
Date added: 2012/02/01 06:20:06
Made with: Algodoo v2.0.0 Edu
Rating: rated 6.3
download
Title: autonomous robot update
Rating: 5
Filesize: 26.04 kB
Downloads: 357
Comments: 0
Ratings: 1
Date added: 2009/10/25 11:53:30
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Hello,
The legs do not move because your code refers to local variables (_leg, _leg1, _leg2, etc) which have not been predefined. If you do not define them, then they will not be saved with the scene. There are a couple of ways that you can define a local variable. One is simply by typing the name of the variable and giving it an initial value. You must define a local variable within the geometry that will use it. So, for example, before you save your scene to your computer, define the local variables by typing their name in the text box located in the upper left corner of the script menu. An example would be:

_leg2 := 1.0 (the colon is not required but it allows error checking if you do use it.). Another way to define a local variable is to place it in the "onSpawn" event handler. That way, the local variables will be defined each time Algodoo gets launched by users.

Hope this helps!
OH! thanks for that man, i didnt realise they had to be difined in the geom it self!thats really helpfull!
still couldnt get it to work for some reson, i have changed it to a scene.my variable for now
You must not be initializing the local variables properly. Did you do it exactly as I stated in my first comment? If you did, then it should work because it did work when I did it.

When you enter _leg := 1.0 into the text box at the top of the spring's script menu, do you see the new variable show up in the script menu as a new item? If you do, then you need to SAVE the scene before you upload the edited scene.

If you would like me to edit your scene so that it has the local variables instead of scene.my global variables, I would be happy to do that for you. Because I am an Algodoo Admin, I could do things like that! :) But I would not do it without your permission.
Last edited at 2017/04/15 18:21:15 by Xray
Ah i see! I think maybe it was because i was doing save and share as one step! Or maybe i messed up the earlier bit as i don’t remember seeing the variable showing up in the scripting window! Anyhow, it all worked allot easier the second attempt! Thanks for your help and the offer, i think i got it now though! Is there a way to test a scene as it would be downloaded? Because obviously it all worked on my pc because it had them defined on my computer?
i ended up changing it slightly to reduce the number or variables as i realised i was using allot more than i needed!
Yes, it looks like you got it working! And you also realized that because those "_leg" variables are "local" variables, you can repeat them as many times as needed without worry that they might interact with each other. Because they are local, you can define the same name in different geometries.

Good job! :tup:

By the way, I test my scenes by downloading them each time I upload a new scene. I found that by doing that I can sometimes catch a bug that I would not see by just running the scene on my own computer. And occasionally, other people might see a problem that I do not see on my own computer, and so I rely on others to tell me if there's a problem (Like I did with you!).
Last edited at 2017/04/16 01:37:32 by Xray
hello. can you please help me in my own? i already made two
Sure, I will try to help you, but let's not do it here on another person's scene. Just ask me a question on any one of MY scenes, and I will try to answer it as best as I can.