dop2000's Forum Posts

  • Try this:

    (Overheat / 6) * (max(WeaponLevel,100) - 100) ^(1.5 * ((max(WeaponLevel,100) - 100) / 10) /2) ,1, 100)

    .

    If it fixes the problem, it will mean that sometimes WeaponLevel can be <100

  • If you are doing it just to hide collision polygons in the layout editor, then of course, it not worth spending hours turning collisions for each tile in each tilemap. It's much easier to move grass and trees tilemaps to another layer and toggle its visibility.

    If you feel confident editing raw project files, you can modify objectTypes/tilemap.json - disable collisions for a couple of tiles, save the project, open that file in Notepad++ and you'll see what to do. However, if you really have 150K tiles, this change will probably add many MBytes to your project size.

  • The methods you mentioned should work - disable a group of events, or check that the layer is visible. They are inconvenient, especially if you have lots of objects and layers, but there are no other solutions.

    Unfortunately, Construct doesn't provide any way to block touch/mouse events for a certain layer. This idea was posted in several variations on the suggestions platform, but got no reaction from the developers.

  • It must be like "goto" or something where maybe people frown upon using it?

    No, ternary operator is perfectly valid and can often be really handy. Unless you start nesting lots of them and the code becomes difficult to understand.

  • Here "recursion" is a fancy way to say that the function calls itself :)

    Actually, for the code to work you need to make variable i global. When it's local, it will reset to 0 every time the function is called. Or pass this value as a function parameter.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What exactly are you trying to do?

    If you want to change the opacity of sprites one by one with 0.2s delay, remove "For each" and add recursive function call as the last action in the function (after "Add 1 to i").

    The function will call itself until there are no more objects with id=i.

  • I would suggest using a separator, for example "mango_5". This way you can have prices with several digits. Use int(tokenat(var, 1, "_")) to extract the price.

  • Yeah, it's a condensed if-then-else statement.

    (A ? B : C)

    If A is true, then the result will be B, otherwise it will be C.

    And you can use nested statements: (A ? B : (K ? L : M))

    The full expression in your case may look like this:

    (int(appleVar)>int(pearVar) & int(appleVar)>int(mangoVar)) ? appleVar : 
    (int(pearVar)>int(appleVar) & int(pearVar)>int(mangoVar)) ? pearVar : mangoVar
    

    It may not work correctly if two numbers are the same.

    EDIT: Just realized that int("abc123") does not extract the number, you'll have to use right()

  • With variables it's quite difficult. If there are only 2-4 of them, you can get away with an expression like (int(appleVar)>int(pearVar) & int(appleVar)>int(mangoVar)) ? appleVar : (int(pearVar)>int(appleVar) & int(pearVar)>int(mangoVar)) ? pearVar : .....

    But if there are more values, you should probably use an array or dictionary. Loop through all values, extract the integer part and compare it with the previous biggest number.

  • I would suggest opening and studying the official templates in C3, starting from the beginner level. They are a great learning resource, demonstrate all C3 features and best practices.

  • There are two addons you can use:

    construct.net/en/make-games/addons

    I tried both and they work very similar. Make sure to add 1-2px transparent border around the images in the animation editor.

  • Define 8 additional image points in your circle sprite (lets call it Gun). The Origin image point should be in the center. Then you can do this:

    Repeat 8 times 
     Gun spawn Bullet at image point (loopindex+1)
     Bullet set angle to angle(Gun.x, Gun.y, Self.x, Self.y)
    

    In Bullet behavior properties set "Set angle=yes"

  • You need to pick an instance of TextBox, try something like this:

    runtime.objects.TextBox.getFirstInstance()....
    

    Is there a reason why you are doing this with scripts? It's easier with events. Besides, only a small part of C3 functionality is exposed to scripts, so I suggest you get familiar with the event system, as it's the primary method of coding in Construct.

  • Yeah, it's for a big project with huge complex tilemaps. Spawning sprites is not an option, unfortunately.

    I found another workaround - I generate a temporary local obstacle map around the character when it crosses the bridge, and disable collisions with the main tilemap using solid collision filters. But a plugin allowing to disable tile collision would make this job much easier.