What's the difference?

0 favourites
  • 7 posts
From the Asset Store
Can you find all the differences? Find the differences before the time out. 10 levels for you to have fun!
  • OK, I'm not that bright but I don't understand why this works:

    Set Position to: choose(spawn1.X,spawn2.X,spawn3.X)

    But this doesn't:

    Set Position to: spawn(choose(1,2,3)).X

    In my mind the output should be the same. Can anyone enlighten me, please?

  • "spawn"&choose(1,2,3)&".x"

  • Noncentz705 Set Position to doesn't accept strings like that either, unfortunately. Believe me, I've tried. :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah, sorry about that. One solution may be to place the objects inside a family. Then you just pick a random instance in the family and then position your object to the selection.

    <img src="http://i.imgur.com/pQ7dQeU.png" border="0" />

  • "Choose" is a value of either text/number format whereas when using the "Create" action expects/let you spawn an instance of an object type.

  • The second form uses object expressions. See the section on object expressions in the manual.

    The expression you gave will pick either 1, 2 or 3, and use that as an index ID (IID) to the 'spawn' object, and return that instance's X co-ordinate. If this is not a syntax error then there must be a different kind of object in your project called 'spawn', so you are using the X co-ordinate of an entirely different object. Your first example uses dfferent object types with different names (spawn1, spawn2 and spawn3) but the second expression will never look at those object types.

    In short, it's probably working correctly but you have misunderstood what the expression is supposed to do.

  • Thanks. I probably shouldn't have posted this in the first place since I was able to achieve what I needed to the first way. I was just curious as to the difference. I understand now. Thank you.

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