Browse Search Popular Register Upload Rules User list Login:
Search:
onKey event demo

Image:
screenshot of the scene

Author: Kilinich

Group: Default

Filesize: 74.67 kB

Date added: 2014-02-23

Rating: 5.6

Downloads: 1227

Views: 625

Comments: 12

Ratings: 2

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

Demo for working with keys.
http://www.algodoo.com/fo … mp;start=0
Last edited at 2014/02/23 22:59:11 by Kilinich
Please log in to rate this scene
edit
Similar scenes
Title: onkey script
Rating: 5
Filesize: 21.31 kB
Downloads: 342
Comments: 1
Ratings: 1
Date added: 2016/01/07 20:01:33
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Events II Demo
Rating: 6.1111
Filesize: 7.69 kB
Downloads: 1047
Comments: 1
Ratings: 3
Date added: 2010/10/18 10:21:55
Made with: Algodoo before v1.8.5
Rating: rated 6.1
download
Title: Cub Throw Demo
Rating: 5
Filesize: 42.61 kB
Downloads: 296
Comments: 0
Ratings: 1
Date added: 2018/01/30 03:39:35
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Algicosalthon Season 3 Day 2
Rating: 5
Filesize: 0.72 MB
Downloads: 1161
Comments: 1
Ratings: 1
Date added: 2019/02/03 17:53:55
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Pull Off Demo (READ DESCRIPTION!)
Rating: 5.625
Filesize: 426.03 kB
Downloads: 1921
Comments: 5
Ratings: 2
Date added: 2010/03/07 01:47:09
Made with: Phun
Rating: rated 5.6
download
Title: The Rocket Bomber 2 New Game Demo (Not Done)
Rating: 5
Filesize: 43.92 kB
Downloads: 600
Comments: 0
Ratings: 1
Date added: 2012/01/06 07:52:40
Made with: Algodoo v2.0.0
Rating: rated 5
download
Interesting demo. But Please explain about ClassObject with children:. I believe that is from Object Oriented Programming (OOP) but how can Thyme interpret that? Also, what is this -> {} and how does it work? This stuff is new to me. :huh:

Thanks
That is just how algodoo serialize objects.
Please answer my questions.

1. What is ClassObject with children? I never heard of that before. How does Algodoo know what that is?

2. What is this -> {}? I have never seen that before in any scripts. What does it do?
this -> {} it's how Algodoo organizes an object that has at the same time other variables or Children that could be called as _local variables , scene.my.variables or normal ones(I think).
For example:
Alice -> {
Age := 20;
Height := 1.60;
Weight := 50
};

Usage: Alice.Weight

The problem is that you could not make new ClassObject with children by yourself or if there's any way I please ask Kilinich for a way of doing it.

You can see many things with ->, the easiest way to see one is: make a box , select it and press ctrl+c , the go to its text and press ctrl+v, at the bigining of the text appears fileInfo -> {...}.
lololoer - Thanks for explaining that! I understand what you said, and it was very helpful, but I still do not understand how ClassObject with children is used in script. When I type those words in the console, Algodoo says that it's undefined. So, is ClassObject with children an actual intrinsic function, or is it simply a text comment that kilinich used to describe his code?

He lists his code, which I'm sure can be very useful, but he does not explain the details of how it works. Without the details, a user, such as myself, has no way of knowing how to use it in scenes.

Thanks again, lololoer! :)
ClassObject with children is a way to describe it, there's no longer definition.
So, if ClassObject with children is only a text comment, then how is it used in script without Algodoo giving an error message? That's the part that I do not understand.

For example: If I type in the console, ThisIsAcomment then Algodoo will give an error message that says "undefined". So, why doesn't Algodoo give an error message when it sees ClassObject with children in the script that kilinich wrote?
Last edited at 2014/02/24 17:24:49 by Xray
I cannot answer you becouse I don't really understand what is the finally of scene.my.e and I don't really understand how the hell does it work, as you, I don't understand this scene :lol: :lol: :lol:
Last edited at 2014/02/24 17:55:25 by lololoer
Okay, thanks. Maybe kilinich will explain it. :huh:
lololoer it just senses when you press a key and randomizes the color of the box -_-.

I need a code to change collision layers on a key. Im making a gearbox and I need to have this happen:

On key R the drive gear switches to collision layer A
On key 1 the drive gear switches to collision layer B
On key 2 the drive gear switches to collision layer C
On key 3 the drive gear switches to collision layer D
AND On key 4 it switches to collision layer E

The drive gear switches collision layers to mesh with each different output gear. So the reverse output gear is on layer A where pressing A would change the drive gear's collision set to collide with the reverse gear and therefore reversing the output rotation.
Jimmyfisherman - The collision layers are configured as a numeric value in the script menu variable "collideSet". The value is a power of 2, where A is 1, B is 2, C is 4, D is 8, etc, up to collision layer J which is 512. Therefore, if you want, say, collision layers A and J to be set, you would enter the value 513 into the collideSet variable (512 plus 1). Make sense?
NOW, almost a year later, I finally figured out how this scene works (I may be a little slow at times)!:lol: First of all, I totally misunderstood what "ClassObject with children" was. I thought that it was a Thyme command that kilinich typed in as code some how! That's why I was puzzled as to how the heck he was able to type that in and not get an error message! Well, now I know that it's not something that he typed in, but it is something that Thyme displayed as information.

This is my take on it:
There are TWO boxes. One that shows text, has no color, and is over the box that has color but no text. In the colored box, in the onKey event, the global variable scene.my.e gets stored with all of the event data within that box, and it gets stored as text. The non-colored box displays all of the text data that is in scene.my.e because of the script { scene.my.e } which is in the text variable. When any key gets pressed, you can see every variable value and event in the colored box that changes.

I think that's how it works. Someone correct me if I am wrong.