oosyrag's Recent Forum Activity

  • Usually you loop through a given path in json to find what you're looking for. Then when it matches, you use that path to look up the rest of the keys you're interested in at that path.

    The most efficient way to me is to organize it so that order doesn't matter. You can have all sorts of different json files, and they can all be loaded into memory/parsed at the start of the game, so that you have access to all the data given you know the path or key/attribute you're looking for. Just imagine if all the files were "included" into your project as one file.

    I normally don't have the game modify json files, only json that is loaded into memory. Considering all the files are loaded into memory and the file that they came from is not relevant, then they don't really need to talk to each other. If you need to write back to the json file, then write whatever is relevant.

  • While I'm at it, here's how I would do it

  • Ok sorry, looks like you didn't need UID. You can pick by the instance variable as you originally intended -

    But here's how to use UID anyway if you were to do it that way.

  • The "Pick by unique id" goes in the function, so that the function actions only apply to that instance of the object. You don't need a separate instance variable for it and you don't need to set the uid.

  • It can be. Just pass the uid of the picked instance as a parameter to the function, and add a pick by uid condition into the function.

    Again though, it's just extra steps that you don't need to take to do the same thing, more easily, by just putting the actions in a "for each" event. (Or a "repeat object.count" times as in the example, which is the same thing)

  • Simply put, functions do not preserve picking from the event calling it, unless you pass that information as a parameter. So all the instances of button are being moved to the same position at the far right, overlapping each other, since there are no instances of the button being picked in the function event.

    One of the reasons when not to use a function unless you're doing something where a function specifically would benefit you.

  • igortyhon's example is solid.

    I just wanted to emphasize what he said about not running events every tick (60 times a second on most monitors). If something isn't expected to change every tick, then it's event should not run every tick. Only run the event as needed when something needs to be changed. Try to use triggered events for everything.

    In this example specifically, you don't need to update the buttons until you click to make a new button.

    Also in general, you don't need to use functions for most things in an event based system like Construct. They definitely have their uses, such as setting return values for what basically amounts to a custom expression, or repeating the exact same set of actions under different conditions, but when starting out I recommend working with the basic condition-action event blocks until you run into a situation you really NEED functions. Otherwise, it is just added complexity that you can get unnecessarily stuck on while learning.

  • Glad it made a difference. Especially true since modern hardware lets us get away with a lot, so it's easy to overlook things like this. It works fine, until it doesn't.

  • Wild guess is that you no longer have the correct event sheet assigned to the layout.

  • Images are loaded into memory at their original resolution, then scaled.

    So use native sized sprites whenever possible unless they need to grow significantly during runtime, then you probably want the higher resolution sprite.

    This is probably having a massive effect on your memory use.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use loop and the loopindex system expression to repeat a set of events with an incrementing number value as a variable.

    Specifically if you're creating the buttons dynamically:

    Repeat n times

    Create button at margin+loopindex*(button.width+padding), y

    If they're existing on layout already, you can use for each instead of repeat. But then you might as well just use the layout editor align options to position your buttons.

  • Deleting all your events and any behaviors, objects, or effects that are not default ones should do the trick.

oosyrag's avatar

oosyrag

Member since 20 Feb, 2013

Twitter
oosyrag has 38 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • Enduring Visitor Visited Construct.net 90 days in a row
  • Unrelenting Visitor Visited Construct.net 180 days in a row
  • Continuous Visitor Visited Construct.net 365 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

21/44
How to earn trophies