Ashley's Forum Posts

  • Whatever you do when an hour has gone by, just do it repeatedly when the app resumes, depending on how many hours went by. A "Repeat" loop should do the trick.

  • Construct games require Android 5.0+, which puts a limit on how old the device can be. Last I checked this covered the vast majority of devices. Other than that, it depends on the game, and it's hard to make comparisons between devices from different manufacturers, so I don't think it's useful to name a minimum device.

  • You linked to the addon SDK documentation, which does not apply to the scripting feature of Construct. That's documented in the scripting section of the Construct manual.

    You can test for preview mode by seeing if the location's origin is preview.construct.net.

    If worker mode is a problem, the easiest thing to do is turn it off. In recent releases of Construct, it defaults to a new "Auto" mode that automatically turns it off if you use any scripts.

  • Oh, I see. I guess that's trickier. Still, I think your attitude to deprecated features should be to not even consider them. If they do end up getting removed in future, then you're creating a new problem for yourself by using them. "Deprecated" does mean "on a path to removal".

  • I'm suggesting to do it the other way round: instead of having a main function that then calls in to a layout-specific function at the end, have layout-specific functions that start by calling the common function. Then you shouldn't need any call-by-string feature at all.

  • Currently Cordova plugins are only included if a Construct addon requests it. The whitelist is designed for Construct plugins like a third-party ad service to include the Cordova plugin that handles the ads, and then the Construct plugin's actions can call the Cordova plugin.

    You could call a Cordova plugin directly from scripting, but currently there's no way to ask the build service to add the Cordova plugin you want unless you make a Construct addon. I guess adding Cordova plugins manually could be an interesting feature. One additional difficulty though is testing is quite tricky: you can only test Cordova code once it's built as an APK, and if it doesn't work you need to set up USB debugging to check what's going on. When you use an addon, the addon developer did all that work to test it and make sure it works, so generally you can trust that it'll just work. If you write your own code you'll have to go through that process yourself.

    You could experiment with this anyway without using the build service, by setting up your own local builds with the Cordova CLI, manually adding a new Cordova plugin to config.xml after export, and then building it, after which your JS code can then call the Cordova plugin. It's a pretty complicated process to go through though, especially if you're new to coding.

  • You should avoid background work at all costs - it will kill the battery life.

    I don't see why you can't just look at the timestamp when waking up, see 10 hours have passed, and then do the same thing as if 10 hours had just passed. For example if every hour you pick a random weather type, when the app wakes up after 10 hours, pick a random weather type 10 times.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Most problems we have with Construct on iOS turn out to be Safari bugs or quirks. It's a really difficult browser to work with and is probably the least reliable and up-to-date of all modern browsers. Apple don't really seem to care about web apps that much, so we end up with problems like their third-party tracking prevention blocking the ability for C3 to remember your login, and system gestures making the side panes difficult to swipe in. If you have problems you can file issues for them, but we can't always work around the limitations of Safari. AFAIK, it works a lot better on Android, Windows, or Chrome/Firefox on Mac.

  • The only amazing thing C2 has that C3 hasn't is a completely open source, unminified runtime

    I have to emphasise: the C2 runtime is not open source. The license does not permit anybody to fork/modify/redistribute it, like you can with open source projects. Also the fact you can view the code is a source of great regret to me, since it resulted in appalling compatibility problems, leaving us with nightmare support problems with angry users who came to us when things stopped working. I'm glad we've largely managed to avoid the same result in C3.

  • pirx - in that example you have declared two entirely different functions, but used scopes to make sure their names don't overlap. The equivalent in Construct is two separate functions with different names.

    Another approach would be to have unique functions on every layout, which themselves call a "common" core function for the parts that are the same. That's probably a simpler way to do it, actually.

    I would strongly advise to find a way to do this with the new functions feature. There should be a reasonable way to do it without having to rely on weird behaviors of old features.

  • I believe it's a bug in Google's ad library. I'm following it up with them at the moment.

  • The parameter description tells you to leave it empty to use the app ID from project properties.

    In other words this should be what you enter for "ID" in project properties, which is the ID of your app. If you leave the parameter empty, it just uses that. You only need to fill it in if you want to request the rating for a different app.

    The parameter description also tells you it's for Android only, so it won't be used on iOS.

  • The fact you can have multiple functions with the same name is basically a design mistake. AFAIK, no other programming languages support this, and it's simply an error to declare the same function twice. So if you were writing code, you could not do this and would be forced to find another way to do it. You should do the same in Construct too, so you don't have to rely on an deprecated, slow and badly designed feature!

    I would suggest using function maps instead. You could have a function that does some basic work and then calls a mapped function at the end using a string variable to continue doing any extra layout-dependent work. Then you change the string variable as you change layout, and the work that the function does will also change accordingly.

  • Just make sure you're waiting for the "ready to use offline" notification - I think sometimes people don't wait for that then go offline, but that means you're going offline before it's fully downloaded everything it needs to work offline.

    Construct 3 is architected so that everything works in full while offline, except for features that connect over the Internet, like cloud save, remote preview, and the build service.

    It's also worth mentioning as always that regular backups are essential for all digital work, in case of software or hardware failure, power cuts, fire, floods, theft, etc.

  • The restrictions of the new functions are intended to both enforce better organisation on your project, and improve performance. For example if you are allowed a function with the same name in two places, you can no longer look at a function and know what it does - you have to be aware of the entire rest of the project and see if there are any other functions with the same name. Besides, there's no reason to do it: you could just use one function with a series of sub-events to do everything in one function. And if for some reason that is difficult or awkward, you probably actually just want two separate functions. Now with the new functions you can look at one function and be confident that is the full logic of the function right there since other functions with the same name are not allowed. This improves your ability to reason about your events. It's also faster since the engine doesn't have to handle iterating over multiple functions with the same name, it just goes to the one function directly and runs that.

    There are also major usability improvements, like being able to properly name and describe parameters, and renaming functions and parameters automatically updates the entire project for you.

    I would strongly discourage you from using the old functions since they have poorer usability and much slower performance. Also in general deprecated features should not be used in new projects, since one day eventually they will probably be removed.

    There's more info in the blog post Construct 3's new redesigned functions and More about Construct's new functions.