Browse Search Popular Register Upload Rules User list Login:
Search:
Tracker+spider (Priority shoot test) 1_4 collab project

Image:
screenshot of the scene

Author: lololoer

Group: Default

Filesize: 76.91 kB

Date added: 2015-01-07

Rating: 5.9

Downloads: 1307

Views: 622

Comments: 14

Ratings: 3

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Improved some things
Btw: I still don't know how to know if an specific object is still 'alive' or is 'death' :huh:
Please log in to rate this scene
edit
Similar scenes
Title: Spider
Rating: 5
Filesize: 27.38 kB
Downloads: 1079
Comments: 3
Ratings: 1
Date added: 2010/04/25 19:51:43
Made with: Phun
Rating: rated 5
download
Title: Project Danmaku
Rating: 5
Filesize: 57.49 kB
Downloads: 1414
Comments: 5
Ratings: 1
Date added: 2020/07/12 11:32:14
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Spider Web
Rating: 7.0834
Filesize: 2.43 MB
Downloads: 1897
Comments: 12
Ratings: 6
Date added: 2014/08/14 04:53:39
Made with: Algodoo v2.1.0
Rating: rated 7.1
download
Title: the mighty Tracker
Rating: 4.5
Filesize: 26.82 kB
Downloads: 412
Comments: 2
Ratings: 2
Date added: 2009/07/26 15:05:39
Made with: Phun
Rating: rated 4.5
download
Title: Thyme Scripted Robotic Spider - T8 Based
Rating: 5
Filesize: 43.95 kB
Downloads: 1313
Comments: 2
Ratings: 1
Date added: 2015/08/29 12:43:40
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Artillery V2
Rating: 6
Filesize: 29.91 kB
Downloads: 918
Comments: 0
Ratings: 3
Date added: 2010/01/08 09:31:24
Made with: Algodoo before v1.8.5
Rating: rated 6
download
This scene is a response to
show list
Title: Tracker+spider (Priority shoot test) 1/4 collab project
Rating: 6.8182
Filesize: 99.7 kB
Downloads: 1610
Comments: 5
Ratings: 5
Date added: 2015/01/07 05:56:38
Made with: Algodoo v2.1.0
Rating: rated 6.8
download
lololoer - There is no way to know if a geom is "dead" because when it has been deleted, there is nothing left of it to test! But one thing you could do is to make an array of all the targets in your scene. Each target will get a value of 0 or 1 (or true false if you prefer) in the array. When a particular object gets killed by a laser, then change the array element to zero (or false) that defines that particular target. That way you have a history of which objects are still alive and which ones are dead.

Will that work for you?
Last edited at 2015/01/07 15:56:04 by Xray
Yes that would work thanks, but how do you test that the object is dead or still alive for the finaly of changing the element to true or false?
Oh yes, I see the problem, and I think I know a way that you can determine if a geom has been killed by a laser, but I will have to test it to make sure it works before I tell you about it. ;) I'll get back to you as soon as I can.
Okay, here is my idea, and it works when I tested it in a simple test scene that I made. You would have to enter the code in the proper places for it to work in your scene.

The general idea of how it works is, each geometry writes a 1 to scene.my.geomArray(n) where, n is the specific number of the geometry. I have a function that writes to a single array element if you need it. So, all of the "alive" geometries are constantly updating their life indicator by writing a 1 to their element in the array. Somewhere else, such as in the code where you would test to see if a geom is dead or alive, you would reset the entire geom array to zeros, such as: scene.my.geomArray = [0,0,0,0] (only 4 elements here for the example). Then you wait a short time period for the array to be updated by all of the alive geometries. Then you look at the specific element that you want to know if it's dead or alive (0 or 1). That's it!
That thing is awesome. I never thought that was possible:)
That's a good idea i'll test it on our spider, thanks! :tup:
1. Create empty scene.my.entity array.
2. onSpawn add entityID to array.
3. onDie remove entityID from array.

If entityID is in scene.my.entity array, then it is alive, else it is dead.
Steve, yeah, that's the actual process (instead that they don't really spawn)
What we need is to find a way to test if an object is dead, having its geomID and WITHOUT using onDie (like, from the green circle). lololoer says that the onDie way to do that is unrealistic and the robot won't be universal (if you paste it in another scene, it won't work unless onDie code is already written)
1. Create empty scene.my.entity array.
2. onLaser hit:
e.geom.controllerAcc == 12.34567 ? {}:{
e.geom.controllerAcc = 12.34567;
add entityID to array;
modify e.geom.onDie code to remove entityID from array}

If entityID is in scene.my.entity array, then it is alive, else it is dead.

This way the robot can be universal. As far as being realistic, well that's a subjective thing.
Last edited at 2015/01/09 10:19:21 by s_noonan
Finally got it working.

_isAlive = (n)=>{
start := Sim.bodyCount;
(Scene.cloneEntityTo((scene.entitybyid(n)), [0, 0])).timetolive = 0;
! (Sim.bodyCount == start)
}

This function given any entityID will return true or false if entity is alive!
Thanks all of you for helping! , homieeee finally got it
homieeee,

Good work. I used the following:

scene.my.entityExists := (ID) => {
x := 0;
x = (scene.entityByID(ID)).entityID;
x > 0
}

I was close, but didn't figure it out until I saw what you did.
Last edited at 2015/01/09 22:17:42 by s_noonan
I think yours is better s_noonan! Since algodoo isn't perfect my script causes a memory leak if used enough but yours is perfect!
Oh I'll try that ASAP. Thanks everyone!
P.S new chat room!