How do I create an object with diff instance variable value

Discussion and feedback on Construct 2

Post » Mon Nov 14, 2016 10:54 am

I want to create same type object with diff variable.For example,I create an Function ,every 1s will create a new object,this object have a variable 'Status',I hope the variable will have diff value,such as 1,2,3,4.....How could I make it?I just know the System object have a function that create object,but I don't know how to pick the new create object and set its' variable.Hope someone can help me.Thank you so much.
B
9
S
2
Posts: 13
Reputation: 551

Post » Mon Nov 14, 2016 1:41 pm

Hi,

The newly created Object is always picked in the event which created it, so you have just to set your variable in this event. If you want your "status" to be random you can use the "choose" expression :
choose(a, b [, c...])
Choose one of the given parameters at random. E.g. choose(1, 3, 9, 20) randomly picks one of the four numbers and returns that. This also works with strings, e.g. choose("Hello", "Hi") returns either Hello or Hi. Any number of parameters can be used as long as there are at least two.
B
14
S
4
Posts: 22
Reputation: 946


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 18 guests