Layers

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

Layers

Postby Kilinich » Wed Jan 23, 2013 10:46 am

There are a great algodoo undocumented feature - layer.
To create a layer, use the command
Code: Select all
Scene.addLayer {visible: = true; color: = [1, 1, 1, 1]; id: = 2; dynamic: = false};

To put a geom on some layer, you need to specify layer id when you create it:
Code: Select all
Scene.addbox {layer: = 2; ...}

or to draw interactively, set active layer by entering command
Code: Select all
scene.selectLayer(2)

Changing the properties of the layer can be done via the same command - scene.addLayer
    visibility - to show layer or not
    color - a factor for all the colors in the layer (eg [1,1,1,0.5] will do a translucent
    dynamic - whether physics cheat on this layer, or it just a "picture"

All that could be very handy if you want to make few locations or just a picture with no performance impact and so on.
Last edited by Kilinich on Thu Jan 24, 2013 8:08 am, edited 3 times in total.
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: Layers

Postby Kilinich » Wed Jan 23, 2013 11:56 am

Demo scene
Press 1,2

Rating: rated 5.6
Filesize: 12.92 kB
Comments: 7
Ratings: 2
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: Layers

Postby s_noonan » Wed Jan 23, 2013 12:34 pm

Interesting. How did you learn about this information?
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Layers

Postby Kilinich » Wed Jan 23, 2013 3:53 pm

s_noonan wrote:Interesting. How did you learn about this information?


Saw that commands in console then pressing tab after "scene."
Then tried to use and looked into scene's code.
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: Layers

Postby s_noonan » Thu Jan 24, 2013 1:20 am

Thanks. I learned something new today!
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Layers

Postby faytree » Thu Jan 24, 2013 1:43 am

wow,marvelous ! you are a teacher of algodoo and all of us are students of you! :clap:
waiting for semester break to come...
User avatar
faytree
 
Posts: 947
Joined: Mon Nov 05, 2012 1:37 pm
Location: Selangor, Malaysia

Re: Layers

Postby Xray » Thu Jan 24, 2013 2:36 am

Хорошая работа!

This is great information! Thanks for sharing. :clap:
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Layers

Postby Xray » Thu Jan 24, 2013 3:30 am

I played around with layers after learning about this, and found that you can do some very interesting things with it!



FUN STUFF!!!
Last edited by Xray on Thu Jan 24, 2013 5:51 pm, edited 1 time in total.
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Layers

Postby Kilinich » Thu Jan 24, 2013 1:08 pm

But remember, this is experimental and unsupported feature! :mrgreen:
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: Layers

Postby Xray » Sat Jan 26, 2013 9:51 pm

Questions about Layers:
1. If I add a new layer (for example, layer id = 1), will the original "default" layer automatically become layer 0 (zero)?

2. If I add textures and geomtries on the default layer (0), and then add and select layer 1, I find that I cannot add existing geometries (such as "Phunlets") to the scene on layer 1. Is that because the phunlets were created while on layer 0? How can I add Phunlets and other pre-existing geometries on a newly created layer?

3. Once layers have been added to a scene, is there a way to REMOVE them?

Thanks
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Layers

Postby Kilinich » Sun Jan 27, 2013 6:42 pm

1. Yes, default is always 0
2. Any entity can be added to any layer with "layer = id" property
3. I did'n find how to do it
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: Layers

Postby guyboy » Sun Feb 03, 2013 1:06 pm

3. Yes, in the background edit menu, the last item is "layers". In the layers menu, the red X deletes layer.
ImageImage
Human horse pasture expansion OpenGL Book Hall
Kwon owned Version (C) 2002-2008
User avatar
guyboy
 
Posts: 80
Joined: Mon Aug 31, 2009 6:19 pm
Location: Ḻ̘̬͕͍͚̥͈͚͖̝̜̲͕̭̩ͅ

Re: Layers

Postby Xray » Mon Feb 04, 2013 5:22 am

guyboy wrote:3. Yes, in the background edit menu, the last item is "layers". In the layers menu, the red X deletes layer.


I clicked on the background edit menu, and I do not see "layers". I'm using V2.0.2 b15 Algodoo for Education. Maybe you are using a different version?
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Layers

Postby monstertje3 » Mon Feb 04, 2013 8:36 am

in the new beta, v2.1.0 b4 there is a layers menu when you left-click the background.
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest