Oncollide inside the spawnscript

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

Oncollide inside the spawnscript

Postby PlanckBanck » Wed Jan 27, 2010 8:41 pm

Simple question:
I want to spawn a circle with an oncollidescript... how to?
for example, i thought of
Code: Select all
oncollide := (e)=>{blablah}


Thanks for reading, and more thanks for answering :P
PlanckBanck
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Oncollide inside the spawnscript

Postby standardtoaster » Wed Jan 27, 2010 8:50 pm

You have it right.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Oncollide inside the spawnscript

Postby PlanckBanck » Wed Jan 27, 2010 8:57 pm

cool, cuz it didn`t work. anyways, thanks, I`ll just have another look at it...
PS: Standardtoaster, you rock, you are some kind of scripting guru, and instead of doing something interesting, you answer every noob`s question after a maximum of 5 minutes, thanks for that!
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin

Re: Oncollide inside the spawnscript

Postby standardtoaster » Wed Jan 27, 2010 10:26 pm

Thank you for the compliment. I assumed that you were putting that inside of the spawning script. It should work that way. Please tell me if the following script is something along the lines of what you are trying to accomplish.
Code: Select all
Scene.addCircle({pos := e.pos; radius := 2; onCollide := (e)=>{e.this.controllerAcc = e.this.controllerAcc + 1}})
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Oncollide inside the spawnscript

Postby PlanckBanck » Thu Jan 28, 2010 12:23 am

it is exactly what I meant, and it worked perfectly! Thanks a very lot.
So long
PlanckBanck
The world is a gas-station, where you`re allowed to smoke. -Friedrich Dürrenmatt

I forgot 2/3 of my scripting knowledge T.T
User avatar
PlanckBanck
 
Posts: 48
Joined: Sun Nov 22, 2009 5:35 pm
Location: In the Bottoms of Berlin


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests