need script help!!

About advanced scenes, and the Thyme scripting language used in Algodoo.

need script help!!

Postby jessebax129 » Wed Apr 07, 2010 5:46 pm

hi i am making a car that has a laser and if that laser collides it has to get towards the car

i want to do that with a spring? so i want to spawn a spring between scene.my.hit1 (thats the car) and scene.my.hit2 (that's where the laser hits) it may look like this?:

(e)=>{scene.addspring({pos:=scene.my.hit2,scene.my.hit2; length := 0 (bacause it has to move the object towards the car); damp:= 2})}

could you guys give me the right code?
jessebax129
 
Posts: 34
Joined: Tue Jan 05, 2010 6:32 pm

Re: need script help!!

Postby Chronos » Wed Apr 07, 2010 5:49 pm

I think it would actually be easier to use attraction instead of a spring.
TheWinkits wrote:They both looks of cuking amazing
User avatar
Chronos
[Most Active Member 2010]
 
Posts: 4457
Joined: Mon Aug 31, 2009 6:00 pm
Location: Californania

Re: need script help!!

Postby jessebax129 » Wed Apr 07, 2010 6:06 pm

no that will not work chronos
jessebax129
 
Posts: 34
Joined: Tue Jan 05, 2010 6:32 pm

Re: need script help!!

Postby Mr_Stabby » Wed Apr 07, 2010 7:25 pm

the problem is you need a geomID within the car to spawn the spring off and you also probably want to be able to release the spring so to kill 2 girls with 1 cup i would make a container to hold a spawned box which would hold on to the spawned spring, scripted for the holding container(you need a seperate laser to trigger)
Code: Select all
scene.addbox({pos:=e.pos; geomID:=1; size:=[1,1]}); scene.addspring({geom0:=0; geom1:=1; world0pos:=scene.my.hit2; world1pos:=e.pos; length:=0;})


to release just kill the spawned box
Mr_Stabby
 
Posts: 155
Joined: Wed Dec 16, 2009 12:16 am

Re: need script help!!

Postby Mystery » Thu Apr 08, 2010 4:24 am

Mr_Stabby wrote:the problem is you need a geomID within the car to spawn the spring off and you also probably want to be able to release the spring so to kill 2 girls with 1 cup i would make a container to hold a spawned box which would hold on to the spawned spring, scripted for the holding container(you need a seperate laser to trigger)
Code: Select all
scene.addbox({pos:=e.pos; geomID:=1; size:=[1,1]}); scene.addspring({geom0:=0; geom1:=1; world0pos:=scene.my.hit2; world1pos:=e.pos; length:=0;})


to release just kill the spawned box

I hate you just a little bit less now :).
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests