netdzynr's Recent Forum Activity

  • Is there a way in Construct to reference a variable's value dynamically?

    For example, if I create 3 global variables "box1", "box2", and "box3", with each having a different numeric value, is there a way to grab the value of "box2" by dynamically building the variable name, something like:

    n = 2

    x = value("box" & n)

    This is sort of similar to eval() in Javascript, but I'm not sure if something like the ExecJS expression can be used to somehow interact with Construct globals.

  • Cipriux

    Thank you so much -- your solution worked for me. Now I remember reading about the loop delay method somewhere. Many thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm trying to insert a delay between the triggering of an opacity tween of 6 sprite instances. Seems like it should be straightforward, but regardless of what I try, all sprites begin their tween behavior at the time. I have this setup in the event sheet:

    What am I missing?

  • Thank you. I was wondering how to physically nest the statements and it took several attempts at dragging the lines in the editor to get them to orient properly. And now I realize that loop names can be variables [forehead slap].

    Aside from the numeric values, does this arrangement look correct?

  • Not sure if this will help, but one example I've seen is a standard fade transition:

    Kind of a lot to sit through, but it works. I seem to recall seeing a plugin or similar that provides transition effects, but I believe that was only for Construct 2.

  • I'm trying generate the above grid of objects dynamically (I want to be able to fade in each cell separately). The method I started using is

    System | for 1 to 5 > create-object "hex_slot" on layer "slots", x: hex_slot.X + (loopindex*150), y: hex_slot.Y

    This allows me to generate the first row. But each instance created has an opacity of 100, so I need to change the opacity of each instance to 0. Or say I want to set an instance variable value of the instance. Would I do this after each instance is created, or use a completely separate repeat loop that runs through all the created instances?

    Also, how do I increment the Y position value to generate the next rows of cells? Typically to build a grid I would use a nested repeat loop, something like this (pseudo code):

    X = 0, Y = 0

    repeat with v = 0 to 5

       repeat with h = 0 to 5

          create object at X+(h*40), Y+(v*40)

       end repeat

    end repeat

    How is this done in Construct, or is a different method needed?

  • I am doing more or less what you propose. But nothing is being destroyed, only made "visible" or "invisible" (using text characters of a custom font).

    Thanks for your recommendations!

  • Thanks for the suggestions. Based on your comments, I decided to dynamically create game objects in position, rather than manually positioning everything in the layout. Of course, this makes things more flexible in the long run and avoids having unneeded objects present in the layout.

    You kind of have a sense of what's going on. Each element of the group of geometric shapes (line or circle) can be enabled or disabled (and potentially recolored), and there are 10 "groups" in the layout. The gameplay isn't intelligible at this point -- it's got a long way to go, but the end goal is a visual puzzle game.

  • Oh, I'm sure I misunderstood the use of containers. I was hoping I could use them as a grouping mechanism to position collections of objects around the layout. But if not, I'll make do and carefully position elements by hand. I placed each set of instances on their separate layers so at least I can select them independently.

    So going back to my original question... If I don't employ containers or families, is there some way to abstract the reference to an instance, something like "shape1 of layer 2", instead of referring to the UID of each instance? At this point, I will have around 10 instances each of 14 source objects, so keeping track of UIDs is quite tedious.

    Thanks as always for your help.

  • I'm trying to figure out a way to have multiple groups of objects where an item within a group is addressable and can have its properties changed. I read up on families and containers, and it seems using containers is the way to go. I created two containers that hold the same elements (the second container is apparently an instance), and each container can be manually selected and recolored, (shown in screenshot). But there's no name or UID displayed for either container. So how do I reference/pick one element of container 2, for example?

  • Thanks for the response. The latter option is what I'm looking for, and works here. But being new to Construct, does adding a Browser object add much overhead to a project? The docs seem to say that the browser object simply exposes capabilities that are already present.

  • How do I set the character of button text to a Unicode character that can't be typed on a keyboard? For example, Arial includes Greek characters, one of which is "?", represented as 'ϕ' in HTML and a Unicode value of 'U+03D5'. How do I assign this character to the text of the button? (using code, not cut and paste)

netdzynr's avatar

netdzynr

Member since 17 Dec, 2017

None one is following netdzynr yet!

Trophy Case

  • 7-Year Club
  • Forum Contributor Made 100 posts in the forums
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies