AirFriction script

Discuss scenes and videos made with Algodoo.

AirFriction script

Postby RafalPL » Tue Aug 23, 2011 2:39 pm

Can i change AirFriction of object by pressing a button? (ctrl, space, shift etc.)
User avatar
RafalPL
 
Posts: 6
Joined: Mon Aug 22, 2011 6:55 pm
Location: Rybnik, Poland

Re: AirFriction script

Postby Kilinich » Tue Aug 23, 2011 10:05 pm

Yes, make a laser with onLaserHit script to change airFrctionMult or world air friction.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: AirFriction script

Postby bozbez » Wed Aug 24, 2011 9:48 pm

Or keybind it...
Image

Go here. Now. That's Now. Not in 5 minutes. Now.
User avatar
bozbez
 
Posts: 149
Joined: Tue Apr 12, 2011 7:01 pm

Re: AirFriction script

Postby Someone Else » Thu Aug 25, 2011 2:44 am

Keybinds are kind of messy and don't serialize.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: AirFriction script

Postby electronicboy » Thu Aug 25, 2011 9:08 am

use kilinich's method.

1. Open the console ( either by tidle (~) or F10).
2. Create a variable by typing 'scene.my.<variablename> = 1' and press enter.
3.Create a laser.
4.open the lazers menu and set the key you want to use
Open the script menu of the laser, and type 'scene.my.<variablename> = (set the value you want here).
5. In the object you want to change the airfriction, open the script menu, and in the airfrictionmul (or siimilar) type '{scene.my.<variablename>}'.

Ps, replace <variablename> with the name of the variable you want...
Ps, script in step 5 is really basic, and only allows one variable... I suggest you read:

[Tutorial]Thyme Tutorial - With explanations at every step

You should never use keybinds for scenes, you should use methods such as a laser with a script...
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: AirFriction script

Postby Someone Else » Fri Aug 26, 2011 4:11 am

Hmm, this got me thinking...

Near-all credit to Grady on this one. He described in that Thyme tutorial in Electronicboy's link how to set up a guard system to keep Algodoo from losing local variables in objects as much.

Code: Select all
scene.my.keyBind = {
    keys.bind("up", {scene.my.power = scene.my.power + 1})
    keys.bind("down", {scene.my.power = scene.my.power - 1})
}

I'm not even sure you need to call on scene.my.keyBind at the start of the scene.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy


Return to Scenes

Who is online

Users browsing this forum: No registered users and 7 guests