Variable tutorial...

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Can someone point me towards a tutorial that explains how to implement variables?

    I've looked through the manual but the explanation seems pretty light. I need a working example so I can see how set them up within the Construct interface.

    Thanks all

  • OK - if no one can point me towards a tutorial, can you help with the following:

    Each time my game loads I want the system to choose a random variable (called result), either 1 or 2.

    So my event currently looks like:

    System > Every tick > System > Set result to int(random(1,2))

    How's this? Does this look right?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • choose(1,2) would be simpler.

    Read the manual for random - 2 will never actually be reached. int(random(1,3)) would give you 1 or 2.

    https://www.scirra.com/manual/126/system-expressions

  • OK - if no one can point me towards a tutorial, can you help with the following:

    Each time my game loads I want the system to choose a random variable (called result), either 1 or 2.

    So my event currently looks like:

    System > Every tick > System > Set result to int(random(1,2))

    How's this? Does this look right?

    Every tick is every frame, so you are setting a new value potentially 60 times per second

    If you just want to set it once each time the layout loads, you would be better off with System->On start of layout

    And if you need it set only once per game session, have it initially set to 0 when you declare it and add System->Compare variable result = 0 as an extra condition

  • Brilliant - thanks for the help. Makes sense

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