A Question on Arrays and Timers

This forum is currently in read-only mode.
From the Asset Store
Goodbye to sprite fonts, when you have something new on the anvil for your upcoming Games !
  • Let me say, I am liking Construct more and more.

    But I am curious as to know if there is a way to define data to be put into an array (Like, an option to put the info into the object's properties other than the size) or if the data has to be created when running the program (defined in an event sheet; sounds like the same but).

    Second, timers. I've looked around for them and wondered how those are used. Even the stuff in the platforming tutorial flew over my head when it used the timers. Like, there are some instances where I'd, say, want something to stop and wait a few seconds.

  • [quote:rdx54dcc]But I am curious as to know if there is a way to define data to be put into an array (Like, an option to put the info into the object's properties other than the size) or if the data has to be created when running the program (defined in an event sheet; sounds like the same but).

    There are numerous ways you could save data for an array. The Array object even has the ability to save and load the array as a file. Or you could store array data as the default value of an object's private variable. Or in a text object. Or in an INI file, which I recently did based off of David's example of a level editor, for use in my own game.

    As for the trouble with timers, if you have any specific questions about the Platform School tutorials feel free to post in that thread. If it's just about timers in general, or the Timer behavior, then this is the right place to post, but I'm afraid you'll have to be more specific with what you're trying to do.

  • Timers in general, actually.

    At least I think I read it right. You see, when I looked at timers I thought of "Do something after X amount of seconds" timers (Or in this case, milliseconds). That's where I am lost.

    In my example and testing, I'm trying to see if I can figure out timers and just get the final result.

    (Conditions)

    While

    "Boxsize" is between 0 and 20

    Every 1000 milliseconds

    (Actions)

    Add 1 to boxsize

    Box: Set height to box.x + 13

    The effect is to have a box slowly change size from small to large through a course of 20 seconds, but instead I just see the large box.

    Also, what I mean is preparing data to be used in an array for the first time. Like, item data (Just now tested to see how arrays are saved and got a whole lot of boxes; seems like they are saved by bits). From the looks of it it looks like I may be better off declaring the data in one big initializing event the first time, then loading the data afterward (saving each time something needs to be modified).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could use the Timer Behavior, and set it to repeat until the object is of the size you want; may be a little neater.

  • "While" is a loop condition. Having a "while" with an every x milliseconds doesn't really make sense, since "While" runs as may times as it needs to. In your case "While" is making the box grow right away, in 1 frame, becasue the boxsize is between 0 and 20. get rid of the "while" and it should work.

  • I agree that it's probably something to do with having a While and an Every in the same condition.

    Personally, when I want something to grow/shrink/move etc independently, I create a group that updates the object every 'n' m/s, and make the group self-terminate (disable) when it reaches it's target.

    So you can enable the group when you want it to happen, and then just leave it to it.

    Sponge.

  • I actually figured it out thanks to Rich's suggestion (The timer thing, anyhoo, in the behavior thing).

    The result was much easier than I made it out to be initially. As a little bonus I even figured out how to make life bars using only boxes.

    Construct does take a bit of getting used to, I admit. And many thanks all who helped me on this!

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