How do I create an object with diff instance variable value

0 favourites
  • 2 posts
From the Asset Store
112 High-Quality destruction sounds for videogames
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)