How to use an object value in an array

For developers using the Construct 2 Javascript SDK

Post » Fri Nov 21, 2014 8:00 am

Image
This is the plugin properties grid as @ashley commented in the edittime.js , So we have some initial values to use for our game. The problem is what should I code to get the initial_value of an cr.property object in construct2? I want this initial_value to be assigned to a another variable I want in runtime.js
for example or (what I've thought of) :
var hitpoint = property_list[2|3] or
var hitpoint = property_list[2|cr_property.initial_value] or
var hitpoint = property_list[2].initial_value or
var hitpoint = property_list[2].cr_property.initial_value or
for ( initial_value in cr_property) { var hitpoint = property_list[initial_value] };

so which one works? if not, can you suggest any idea if you know?
ImageImageImageImageImage
B
56
S
15
G
5
Posts: 852
Reputation: 11,446

Post » Fri Nov 21, 2014 8:43 am

@Naji

var speed = this.properties[0];

See official bullet behavior.
B
109
S
27
G
277
Posts: 4,482
Reputation: 154,924

Post » Fri Nov 21, 2014 9:28 am

Construct 2 does not remember the initial value. It only tells your plugin what the properties' current values are. If you want to know the initial value, you have to hard code it in to the runtime script too.
Scirra Founder
B
399
S
236
G
89
Posts: 24,530
Reputation: 195,402


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests