How do I call a random or choose function?

Not favoritedFavorited Favorited 0 favourites
  • 5 posts
From the Asset Store
Basic clone of a 80's arcade game called Gyruss that was quite fun to play!
  • Can someone post an example of this? I don't understand what to fill in at or 'do' with the mapping function. If someone could post it I would be greatful and I'm sure others would be too!

    Basically I'm just trying to call a random function, or use 'choose'.

    C2 made it much easier to do this I wonder why it was made more difficult?

  • I talk a bit about Function Mapping in this tutorial where it's used to call functions from a JSON dialogue file. It also has an example project included.

  • Hi, thanks for your reply.

    I looked at the tutorial and file but it only makes it more confusing with the json stuff and everything around it. I'm just looking for a simple 'clean' example how to call a random or chosen function.

    For example;

    Function 'CallAnyFunction' > Call random(Function1, Function2) OR Call choose (Function1, Function2).

    Function1 > Do this

    Function2 > Do that

    This was super easy in Construct 2 I don't understand this new technique in C3 at all.

  • Basically, with a function map, you would create the map at the start of the layout by using:

    CONDITION

    System ▶︎ On Start of Layout

    ACTION

    Functions ▶︎ Map “FunctionMap” string “FunctionOne” to FunctionOne

    This creates a map called FunctionMap, and then maps the function called FunctionOne to the string "FunctionOne". Then, when you want to call the function using the string you'd use the Call Mapped Function action, specifying the map you need and the string. If you wanted to choose randomly from a set of strings, you can use the choose expression in the String parameter.

    This example is adapted from the official Function Maps example.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is an easier way to do this with a bit of scripting. However, this method will not work with advanced minification.

    .

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