Certainly function

Hello, seeing the examples I doubt arises because when we access a button with this function:

local obj = myLevel:getLayerObject(layerName, objectName).view

If I put .view not work and the other objects if?

Hi,

Sorry I’m not too sure what you mean but for Level Director button objects you do not need the .view property as a button is more than just a display object.

For example;

btnUp = myLevel:getLayerObject("Controls","btnUp") btnUp.onPress = upPressed

Does this help?

If I refer to it, do not understand that neither the buttons or the camera is not necessary

.view, With other objects if it is.

Thank you very much for the reply.

In LD all objects can be referenced without the .view property and then when you need to reference the physical display object you do it through the view e.g.

obj = myLevel:getLayerObject("layer1","player") obj.view.x = 10

Even buttons have a view which is actually a display group consisting of multiple display objects e.g. image and text;

btn = myLevel:getLayerObject("layer1","button") btn.view.x = 100 btn.view.y = 200 btn:disable()

So basically you just need to add .view when wanting to modify the visual part of an object.

One more question, two-level properties in the Scroller example, are;

myLevel.damping = 1

myLevel.focusLayer = “BG”

These properties where they are?

damping – this allows you to dampen the scroll speed across all layers, the default is 1.0 but could be used to simulate walking through mud for instance by specifying a lower number.

focusLayer – this was just a user-defined variable I setup but never actually used so you can ignore this (I’ll remove it).

Hi,

Sorry I’m not too sure what you mean but for Level Director button objects you do not need the .view property as a button is more than just a display object.

For example;

btnUp = myLevel:getLayerObject("Controls","btnUp") btnUp.onPress = upPressed

Does this help?

If I refer to it, do not understand that neither the buttons or the camera is not necessary

.view, With other objects if it is.

Thank you very much for the reply.

In LD all objects can be referenced without the .view property and then when you need to reference the physical display object you do it through the view e.g.

obj = myLevel:getLayerObject("layer1","player") obj.view.x = 10

Even buttons have a view which is actually a display group consisting of multiple display objects e.g. image and text;

btn = myLevel:getLayerObject("layer1","button") btn.view.x = 100 btn.view.y = 200 btn:disable()

So basically you just need to add .view when wanting to modify the visual part of an object.

One more question, two-level properties in the Scroller example, are;

myLevel.damping = 1

myLevel.focusLayer = “BG”

These properties where they are?

damping – this allows you to dampen the scroll speed across all layers, the default is 1.0 but could be used to simulate walking through mud for instance by specifying a lower number.

focusLayer – this was just a user-defined variable I setup but never actually used so you can ignore this (I’ll remove it).