Script for spring
			15 posts			 • Page 1 of 1		
	
Script for spring
Hey  
 ,
I just want a simple script to change the power of the spring. From 10000 N/m to 0 N/m. And one from 0 N/m to 10000 N/m. Anybody?
Thanks!
Bartimans
			
		I just want a simple script to change the power of the spring. From 10000 N/m to 0 N/m. And one from 0 N/m to 10000 N/m. Anybody?
Thanks!
Bartimans
- Bartimans
 - Posts: 17
 - Joined: Sat Jul 17, 2010 7:34 pm
 
Re: Script for spring
When do you want the spring's strength to change? After a certain amount of time? When a certain object collides with another object?
			
I don't suffer from insanity. I enjoy every minute of it.
- 
				

Rrobba - [Best Sig 2010]
 - Posts: 1480
 - Joined: Mon Aug 31, 2009 6:01 pm
 - Location: Gibraltar
 
Re: Script for spring
First you need to define custom variable scene.my.x (type in console scene.my.x = 0).
Then set spring strength in script menu to "{scene.my.x}".
Now you can control spring via scene.my.x variable.
			Then set spring strength in script menu to "{scene.my.x}".
Now you can control spring via scene.my.x variable.
Dream of Algodoo as game development engine...
		- 
				

Kilinich - [Best bug reporter 2010]
 - Posts: 2098
 - Joined: Mon Aug 31, 2009 8:27 pm
 - Location: South Russia
 
Re: Script for spring
Ehm, other question. What is the script for springs that it goes every time that the i push ( say 1 or something) go up with 1. I have {scene.my.x = +1} and on the spring i have {scene.my.x}, it works one time, after that not more. So??  
  (Sorry for my English)
			
		- Bartimans
 - Posts: 17
 - Joined: Sat Jul 17, 2010 7:34 pm
 
Re: Script for spring
Bartimans wrote:Ehm, other question. What is the script for springs that it goes every time that the i push ( say 1 or something) go up with 1. I have {scene.my.x = +1} and on the spring i have {scene.my.x}, it works one time, after that not more. So??(Sorry for my English)
scene.my.x = scene.my.x+1
?
Dream of Algodoo as game development engine...
		- 
				

Kilinich - [Best bug reporter 2010]
 - Posts: 2098
 - Joined: Mon Aug 31, 2009 8:27 pm
 - Location: South Russia
 
Re: Script for spring
Kilinich wrote:Bartimans wrote:Ehm, other question. What is the script for springs that it goes every time that the i push ( say 1 or something) go up with 1. I have {scene.my.x = +1} and on the spring i have {scene.my.x}, it works one time, after that not more. So??(Sorry for my English)
scene.my.x = scene.my.x+1
?
Yeah i have that. When i add the script on the spring {scene.my.x} it colors white and don't change??
- Bartimans
 - Posts: 17
 - Joined: Sat Jul 17, 2010 7:34 pm
 
Re: Script for spring
Sounds like you put the code in the color box instead of the length box. You sure you put it in the right one?
Also, yeah, scene.my.x = +1 doesn't work. You need scene.my.x = scene.my.x + 1.
			Also, yeah, scene.my.x = +1 doesn't work. You need scene.my.x = scene.my.x + 1.
TheWinkits wrote:They both looks of cuking amazing
- 
				

Chronos - [Most Active Member 2010]
 - Posts: 4457
 - Joined: Mon Aug 31, 2009 6:00 pm
 - Location: Californania
 
Re: Script for spring
i have now on the circle "(e)=>{scene.my.x = scene.my.x + 1}" on the spring i want to add the cript {scene.my.x}. But the code collors white. Not the spring (sorry for the miss understand). It means it's isn't good, the script.
			
		- Bartimans
 - Posts: 17
 - Joined: Sat Jul 17, 2010 7:34 pm
 
Re: Script for spring
Have you defined scene.my.x in the console yet?
			TheWinkits wrote:They both looks of cuking amazing
- 
				

Chronos - [Most Active Member 2010]
 - Posts: 4457
 - Joined: Mon Aug 31, 2009 6:00 pm
 - Location: Californania
 
Re: Script for spring
I have made a simple scene. http://www24.zippyshare.com/v/7254773/file.html. The bleu springs i want to let "grow". The green are just for fun. So don't know what i do wrong?
			
		- Bartimans
 - Posts: 17
 - Joined: Sat Jul 17, 2010 7:34 pm
 
Re: Script for spring
Chronos wrote:Have you defined scene.my.x in the console yet?
TheWinkits wrote:They both looks of cuking amazing
- 
				

Chronos - [Most Active Member 2010]
 - Posts: 4457
 - Joined: Mon Aug 31, 2009 6:00 pm
 - Location: Californania
 
Re: Script for spring
Chronos wrote:Chronos wrote:Have you defined scene.my.x in the console yet?
uhm... When you tell me what a console is that i can tell you of i did.
- Bartimans
 - Posts: 17
 - Joined: Sat Jul 17, 2010 7:34 pm
 
Re: Script for spring
Press the tilde key (~), type scene.my.x = 1, then press enter. After that, enter your codes in the object and spring again and it should work.
			TheWinkits wrote:They both looks of cuking amazing
- 
				

Chronos - [Most Active Member 2010]
 - Posts: 4457
 - Joined: Mon Aug 31, 2009 6:00 pm
 - Location: Californania
 
			15 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 7 guests



