Properties at runtime

For developers using the Construct 2 Javascript SDK

Post » Sun Feb 05, 2012 3:57 pm


Is there a way to make the properties exposed in the edittime.js available at runtime via runtime.js (ie: for use in events). Or do I need to make actions to set and expressions to get?
B
28
S
5
G
1
Posts: 30
Reputation: 1,889

Post » Sun Feb 05, 2012 8:59 pm

I'm not sure what you mean - have you looked at the SDK docs or the other plugins and behaviors that come with Construct 2? All the properties are right there in this.properties, available in onCreate().
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Sun Feb 05, 2012 10:50 pm

[QUOTE=Ashley] I'm not sure what you mean - have you looked at the SDK docs or the other plugins and behaviors that come with Construct 2? All the properties are right there in this.properties, available in onCreate().[/QUOTE]

I didn't see anything in the docs about making the editmode properties avaialable to events at runtime.

When I try to access them on the object via event sheet expressions those properties that are available in the editor (such as OriginX, OriginY etc in my Ease plugin) are not there.GauVeldt2012-02-05 22:51:22
B
28
S
5
G
1
Posts: 30
Reputation: 1,889

Post » Sun Feb 05, 2012 11:03 pm

Extract from Properties

[quote]Getting property values at runtime

In your instance's onCreate() function in runtime.js, properties are available via the array this.properties[]. This is an array of the property values. The values are in the same order as the properties were added, excluding link properties. For example, if you have two link properties followed by three integer properties, this.properties only has three elements (the three integer properties in the order they were added). [/quote]

this.properties is an array.
The first property is accessible via this.properties[0], etc...
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sun Feb 05, 2012 11:10 pm

[QUOTE=Kyatric] Extract from Properties

[quote]Getting property values at runtime

In your instance's onCreate() function in runtime.js, properties are available via the array this.properties[]. This is an array of the property values. The values are in the same order as the properties were added, excluding link properties. For example, if you have two link properties followed by three integer properties, this.properties only has three elements (the three integer properties in the order they were added). [/quote]

this.properties is an array.
The first property is accessible via this.properties[0], etc...[/QUOTE]

That doesn't answer the question. Runtime means the game at runtime via event sheet. See previous post. Your answer is referring to the actual JS code of the plugin. I want them available in the game at runtime via the event sheet.GauVeldt2012-02-05 23:15:58
B
28
S
5
G
1
Posts: 30
Reputation: 1,889

Post » Sun Feb 05, 2012 11:20 pm

You have to expose them through the ACE (so as you said in your first post "make actions to set and expressions to get").

That's the logical thing to do seing that properties are an array.
It's on the dev's hand to expose and adapt those properties according to the plugin.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sun Feb 05, 2012 11:30 pm

[QUOTE=Kyatric] You have to expose them through the ACE (so as you said in your first post "make actions to set and expressions to get").

That's the logical thing to do seing that properties are an array.
It's on the dev's hand to expose and adapt those properties according to the plugin.[/QUOTE]

That's what I suspected but I wanted to be sure. So expressions for getXxx access and actions for setXxx then I guess would be needed.
B
28
S
5
G
1
Posts: 30
Reputation: 1,889


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests