key_down / key_up events

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

key_down / key_up events

Postby Kilinich » Wed Jan 19, 2011 12:18 am

Useful phunlet I suppose :)
It runs any script only once on key press and once on release (each time key pressed).

Rating: rated 6.1
Filesize: 42.61 kB
Comments: 4
Ratings: 3
download
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: key_down / key_up events

Postby Kilinich » Wed Jan 19, 2011 12:22 am

For example if you set activationButton for laser to "mouse_left" (it can be done via clipboard or .phn file edit) and add key_up script "scene.addGroup({name := "selected"})", it will prevent you to select anything with left mouse click on sim running.
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: key_down / key_up events

Postby Someone Else » Wed Jan 19, 2011 7:30 pm

Could it be possible to do something like this that is activated onCollide and has two different scripts? So when you set a ball on the floor, the floor's controllerAcc = controllerAcc + 1, and when you pick up the ball the floor's controllerAcc = controllerAcc - 1 so the floor keeps a running count of how many balls (or chairs or elephants) are on it?
So this could be used to more precisely simulate surface tension in a liquid by changing the attraction of a ball depending on how many other balls are touching it?
If that made any sense...
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: key_down / key_up events

Postby Kilinich » Thu Jan 20, 2011 12:05 pm

Not gonna work with collisions :(
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: key_down / key_up events

Postby davidz40 » Thu Jan 20, 2011 2:04 pm

If You want to detect pressure on stationary things, You can use that.
Rating: rated 5
Filesize: 15.1 kB
Comments: 2
Ratings: 1
download


Or use two floor planes very close to each other, and make upper one an alternating collider. Then, it's oncollide will increase controlleracc when having collision A (so +1 for each touching object), and decrease when having the other collision group.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: key_down / key_up events

Postby Someone Else » Thu Jan 20, 2011 6:49 pm

Wait... what? Could you make a demonstration please?
Sorry I can't test the pressure sensor thing, I will do it tomorrow. At the moment, I do not want Algodoo to create the folder on my hard drive.

But, would it be possible to do that alternating collider thing on a bunch of balls so they all know exactly how many others they are touching?
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: key_down / key_up events

Postby davidz40 » Thu Jan 20, 2011 9:22 pm

I tried to make demonstration, and it kinda worked, but algodoo seems to have big problem in deciding how many collision occured, and the oncollide is ran wrong number of times. (I put 1 circle and it says 1, then I put another and it says 0 or stil 1l or whatever)
Anyway, theres the buggy concept:
Rating: rated 5
Filesize: 23.02 kB
Comments: 0
Ratings: 1
download
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests