vee41's Recent Forum Activity

  • Use 'else' condition on second condition, that should work.

  • Do it like this : round(random(0,10))

  • System -> compare two values

  • Put your data into array and use gchapter to index y of the array. Each x value would hold the relevant stuff for the level.

  • You'll need to add 'regenerate obstacle map' event at the end of the build mode / start of the play mode. Path-finding needs to 'regenerate' it's map as it doesn't dynamically update when you add solid objects into play :)

  • So, I could use instance variables specific to each enemy, but then I can't access it through the family. I could set a family instance variable and let it be inherited by the objects in the family, however that would effectively set them all to the same health.

    You can actually do this.

    Create a family, add objects and shared variables into it. Now go look into objects variables in the editor and you'll see the family's variables in the objects properties. You can set them into whatever you desire, so different enemies can have different health by default. :)

  • Every object has object.count function which returns number of specific object instances in the game. So carn.count returns total number of carn instances in the game.

    You can use 'pick all' in system menu to pick every single instance of the object, then you could use 'pick nth' instance in system menu to pick object.count-1 to pick last (latest) instance of the object. Or which ever instance you desire.

    Hope this answers your question :)

  • Object.Pickedcount gives you the amount of instances of the referenced object that are currently picked, meaning, how many instances of object your actions affect. With object.pickedcount 2, you currently have 2 objects picked and so doing 'object.variable = 1' would set that variable to 1 for both of those objects.

    If you are seeing pickedcount = 1, then you only have single instance of the object picked. Picking is the thing I had hardest time grasping with C2, it is really powerful tool when you learn to use it properly! :)

    Hope this helps, it's hard to say where the problem exactly is in your case without seeing the .capx of your project :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the instance variables are all set to 0 when the object is spawned and that's why all spawn on the same spot and with the same color ...

    I could be wrong ...

    Try positionning them out of the layout , and just moving them

    Instance id is not unique to an object, it is just an index to selected objects :-) So if picked objects change you cannot use same iid to reference the object anymore.

  • Uids would be Id assigned at creation, its number assigned to every object at creation. Yes, incremental like you said, bit if you create object_rock and it gets uid 13, if next object created is object_tree it would get uid 14. So uids are not object specific but shared between. All objects.

    iids on other hand are ways to browse list of selected objects. If you have picked 5 tree objects you could refer each one with rock(0), rock(1) etc.

    In your case it seems that there are more than two objects selected. Try what this returns: carn(pickedcount-1).uid I imagine that might be the uid of the last selected object which should be the one created. :-)

  • You could make objects in other layouts global and hide them from layouts they are not needed in. I suggest that you find other approach to the problem though (saving in array, passing variables when changing layout for example)

  • This could work: save parents uid into variable of the child (var_parent). Now you can do cool stuff like pick every child of certain carn with event like this :

    carn.var_parent = parentcarnUID

    .. Set variables to same as parent

    After you create new,object in construct it is picked automatically. If You created it from same object id guess they would both be picked. You Can browse them using iid(number of selected instance after name)

    carn(0).uid = parent uid

    carn(1).uid = child uid

vee41's avatar

vee41

Member since 12 Apr, 2012

None one is following vee41 yet!

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

14/44
How to earn trophies