How do you bind keys to adjust a spring's length?
4 posts • Page 1 of 1
How do you bind keys to adjust a spring's length?
really what i'm asking what commands increase and decrease a spring's length, so i can bind some keys to those, also i want to variate the speed with with they extend, retract. Thanks ahead of time.
- metalmaggot66
- Posts: 5
- Joined: Mon Oct 19, 2009 10:47 pm
Re: How do you bind keys to adjust a spring's length?
I'm not a script master, but i know a little bit. Use a variable like scene.my.springlenght=*spring lenght* then, in the spring script menu, you put in the lenght part: {scene.my.springlenght} then, you can put an oncollide mechanism like scene.my.springlenght=scene.my.springlenght+*value you want to add and scene.my.springlenght=scene.my.springlenght-*value you want to subtract

*instead of springlenght you can put anything you want for variable
*instead of springlenght you can put anything you want for variable
-

Cristianol - Posts: 28
- Joined: Mon Nov 16, 2009 7:58 pm
- Location: Rio de Janeiro Brazil
Re: How do you bind keys to adjust a spring's length?
See, I want it to change by a constant speed as long as im holding down the button, not incrementally.
*Edit* Nevermind, i just used onHitByLaser and a small increase value, thanks for the info
*Edit* Nevermind, i just used onHitByLaser and a small increase value, thanks for the info
- metalmaggot66
- Posts: 5
- Joined: Mon Oct 19, 2009 10:47 pm
Re: How do you bind keys to adjust a spring's length?
make two lasers and two boxes. like this;
[laser]----------------[Box]
[laser]----------------[Box]
One laser acivates on for example the up key, the other on the down key.
Put this code in the first box's onlaserhit; "scene.my.springlength = scene.my.springlength + 0.1" Lengthens
In the second box do the same but with this code; "scene.my.springlength = scene.my.springlength - 0.1" Shortens
And in the spring length script box;"{scene.my.springlenght}"
You can add maximuin and minimum lengths using if statements; eg.
{if} ? {true} : {false}
{scene.my.springlenght =< 1} ? {scene.my.springlenght = 1} : {scene.my.springlength = scene.my.springlenght - 0.1}
[laser]----------------[Box]
[laser]----------------[Box]
One laser acivates on for example the up key, the other on the down key.
Put this code in the first box's onlaserhit; "scene.my.springlength = scene.my.springlength + 0.1" Lengthens
In the second box do the same but with this code; "scene.my.springlength = scene.my.springlength - 0.1" Shortens
And in the spring length script box;"{scene.my.springlenght}"
You can add maximuin and minimum lengths using if statements; eg.
{if} ? {true} : {false}
{scene.my.springlenght =< 1} ? {scene.my.springlenght = 1} : {scene.my.springlength = scene.my.springlenght - 0.1}
-

Nxdt - Posts: 1019
- Joined: Mon Aug 31, 2009 6:32 pm
- Location: Scotland!
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest



