dop2000's Forum Posts

  • I believe Set Color effect takes values 0-100, so you need to divide R,G,B values from Color Picker by 2.55

  • You know, at some point you're going to need to write a demo for how to add credits to a game

    :)

    You can manually place the camera sprite above the player on each layout. Or add this action:

    On start of layout -> Camera set position to Player.x, Player.y-250

  • You need to rename the animations in B1Who2 sprite. For example, where the puppy is playing with the butterflies, the animation should be "PuppyButterflies".

    Other small issues - on "the brown puppy" text, fix the value in the Who variable, it says "Pupply". And you have two copies of B1When2 sprite for some reason.

  • Web font takes some time to load (about 1 second at most). I don't know why you need to refresh the layout though.

    What I did in my game - I placed a text object with just a dot "." on the Loader layout and hid it behind the logo sprite. So when the loader layout starts it load the webfont for this text. And then, when my next layout starts, the webfont is already cached and appears immediately.

  • Well, you can't just copy-paste my code into your project and expect it to work.. First, you need to load the JSON data into the array. And in your array player position is at index 2.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I may be wrong, but I think you can simply configure "Privacy Policy" and "Location to show user consent dialog" settings on the Mobile ADs plugin, and that's it. The dialog will be automatically shown to users from the EU, and if they don't give their consent, they will be served non-personalized ads.

  • Ok, forget about ternary operator. With the goalkeeper, 3-4-3 formation:

    For "n"=0 to 10
    
     If loopindex=0 : Array set "GK" at X=loopindex, Y=..
    
     Else If loopindex<4 : Array set "DF" at X=loopindex, Y=..
    
     Else If loopindex<8 : Array set "MD" at X=loopindex, Y=..
    
     Else : Array set "AT" at X=loopindex, Y=..
    
    
  • You are probably overwriting the name, check your code.

    3-4-3 is first 3 players are "DF", next 4 players are "MD", and next 3 players are "AT", right?

    So if you are looping from index 0 to 9, loopindex<3 are "DF". You can use a short version of if-then-else for this, it's called ternary operator:

    loopindex<3 ? "DF" : "something else"

    And then nest another ternary operator inside:

    (loopindex<3 ? "DF" : (loopindex<7 ? "MD" : "AT"))

  • Just change the expression. For 3-4-3 it will be (loopindex<3?"DF":loopindex<7?"MD":"AT")

    Or you can do it the long way with several sub-events:

    If loopindex<3 : Array set... "DF"
    Else If loopindex<7 : Array set... "MD"
    Else : Array set... "MD"
    
  • Check out the "Blend modes" template in C3. You can put the color wheel and the mask sprite on a separate layer, set "Force own texture=yes" and they will not affect other layers.

  • Ok, I tried it. But it doesn't sort the array of players, it simply assigns different positions to the first 11 players. So player #4 for example, can be DF in formation 5-3-2. But the same player #4 will become MD in formation 3-4-3. The remaining 7 players are not used at all.

    If this is what you want, then it's very easy. For formation 5-3-2:

    Repeat 10 times: 
    Array set (loopindex<5?"DF":loopindex<8?"MD":"AT") at x=loopindex, y=1
    
  • So you want to "toss a coin" and if it's "heads", then you run the function, correct?

    The easiest way is to use condition choose(0,1)=1

    If you need a 20% chance for example, then use random(100)<20

  • You should've given all these additional details from the beginning.. Yeah, my method will not work.

    So if there are 18 players in the array, and you want to make the formation 5-3-2, what should happen? First 5 DF players move to the top of the array, and the reserve DF players (if there are any) should stay in the end of the array? Or you need to remove all reserve players, only leaving 10 people in the array?

    I think it would be easier to copy records to another array.

    Or even easier if you had sprite instances instead of the array. 18 instances, you pick all DF, mark first 5 of them as selected for the game. Then pick all MD players, select 3 of them, then pick AT player, select 2 of them.