dop2000's Forum Posts

  • Most common method is to use global variables for values which you need to be available across multiple layouts. You can also use dictionaries, arrays, JSONs.

  • Where do you currently store this progress? Is it in instance variables on the player sprite, or in global variables?

    With global variables, the progress should not reset when you switch between layouts. Unless you perform "Reset global variables" action, in which case - don't :)

    You can also use a Dictionary to store things like player stats, gold, scores etc. One advantage of dictionaries is that they can easily be saved in Local Storage.

  • Are you pasting the sprite on the Canvas? Try waiting longer before destroying the sprite - use "Wait 0.2s" instead of "Wait for previous action"

  • You can use the same approach for string variables. If you want to compare a part of the string, use expressions like find(), left(), right(), lowercase() etc.

    But then you will need to pick instances using System events, for example:

    System Pick Workers by evaluating Left(Worker.name,4)="John"

  • I assume the workers are instances of the same sprite?

    I strongly suggest using number variables instead of boolean - they are much easier to work with in Construct. Just assign 0 for false and 1 for true.

    For example, to count the number of workers who have plague, you can use this code

    Local variable n
    Local variable percentage
    
    For each Worker
    Worker hasPlaque=1 : Add 1 to n
    
    Set percentage to int((n/Worker.count)*100)
    

    Another method without the loop:

    Worker hasPlaque=1 : Set percentage to int((Worker.pickedCount/Worker.count)*100)
    

    Basically pick instances by comparing instance variables and count them. When multiple instances are picked, you can use Object.pickedCount expression. For total number of instances use Object.count expression.

  • Another option is to use Permutation Table feature of the Advanced Random plugin.

    dropbox.com/s/tdusbon5jofn4py/TilemapPermutation.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It will be much easier to use MoveTo behavior here - you can give it waypoints for the entire path.

    If you need to use Tween, I would suggest giving tags to tweens. Move them all into a function. Instead of using "Repeat 10 times" loop, run the function once. When the last tween ends (use "On Tween Finished" trigger), run the function again.

  • I think it's the 0,0 position (which 0 is somehow being stored in the array and thus picked as a position to animate)

    Are you resetting the array size to 0 before filling it? Set width to 0, height and depth to 1.

  • Not really...

  • System Save action saves absolutely everything (except for objects with NoSave behavior). It may work for many games, but sometimes you don't want to load some data. For example, you have a volume setting in your game and you reduced volume to 5%. But loading an old save will also load old volume value which was 100% when it was saved. Avoiding things like these is quite difficult. That's why sometimes it's better to make your own save system, where you can control what data is saved or not.

  • In C2 you can pass function parameters when calling a function, in this case pass EnemyMask.UID

    Inside the function use Function.Param(0) to access this parameter value.

  • You can use instance variables and Timer behavior. For example, create "seq" instance variable, pick 5 random circles, assign them seq values from 1 to 5.

    Start a Timer for these picked circles for (2.5+Circle.seq*0.5) seconds.

    This means that the timer for the first circle will trigger in 3 seconds, the timer for the second circle in 3.5 seconds and so on.

    Check out official examples in C3 to learn how to use Timer and other features.

  • If "CodeTextBox" text is: W84FJ3JK then:

    Wait for "CodeButton" to be pressed

    When "CodeButton" pressed then:

    Add "1200" to "Coins"

    It's always recommended to use triggered events when possible. This way your code would only run once when the button is pressed, and not on every tick.

    On CodeButton Pressed <<-- this is a triggered event
    CodeTextBox Compare Text = W84FJ3JK <<-- second condition in the same event
    .. Add 1200 to "Coins"
    .. etc.
    
  • It isn't hard with lerp function: lerp(x1, x2, 0.5), lerp(y1, y2, 0.5) is the middle point between two coordinates.

  • I am not sure if replacing lots of numbers in a large JSON and then loading this JSON back into the tilemap will be any better for performance.

    I too have animated tilemaps in my project and I'm only updating the tiles which are inside the visible area, in my case this is about ~1000 tiles. Updating them every 0.16s only costs a couple of %% in CPU utilization.

    Let's say there are 5 animated tiles in the tilemap - from 10 to 14. After tile 14 the animation restarts from tile 10 again. Then the code can be something like this: