sandulas's Forum Posts

  • 5 posts
  • Hi all,

    Is there a way to log a custom statistic as a fixed value rather than an increment?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi! I have the same problem when I launch my game in iOS launcher. But I worked around this problem by putting all audios files from Music folder to Sounds folder under construct 2. And then my music plays without the need to touch the screen.

    The above works for me as well. I also had the problem when previewing the game in the iOS browser (Safari), not just when exporting to CocoonJS (in the browser the music still doesn't start on the start of the layout, I have to tap somewhere in the window).

  • Thanks everyone!

    Ashley, I understand what you mean, so everything makes sense (although it works differently from most programming languages, where the variable is holding a unique state for each function call only if it is declared inside the function).

  • The variable is declared in the "Main" group in my example (see the .capx). So this group should be the scope of the variable, not the on start event. Quote from the manual:

    "For example, if an event variable is in a group of events, it becomes a local variable. Then, it will only appear as an option for a variable in events inside that group. In other groups or in other event sheets it does not appear at all and cannot be accessed. This makes the variable local to the scope in which it is placed."

    Also from the manual:

    "By default, local variables reset to their initial value whenever entering their scope (usually every tick), like local variables in programming languages"

    So the variable should be reset only when entering the group.

  • Link to .capx file (required!):

    docs.google.com/file/d/0B3gyd8mDsXNlQVA1YnJpb1JPblE/edit

    Steps to reproduce:

    1. create a new event group

    2. add a local variable inside the group

    3. create a new function that sets the value of the local variable

    4. call the function in the "on start of layout" to set the variable value to 100

    5. display the value of the variable in a text

    Observed result:

    the value is zero

    Expected result:

    the value should be 100

    the local variable shouldn't be reset since we're not leaving its scope; this can be solved by marking the variable "static", but that is not the point.

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: yes

    Operating system & service pack:

    windows 7 SP1

    Construct 2 version:

    r139

  • 5 posts