LaurenceBedford's Forum Posts

  • That's what I told you 2 days ago! Check this comment:

    https://www.construct.net/en/forum/construct-3/how-do-i-8/sort-array-152524#forumPost1010451

    That demo that you gave worked like that. It assigned different roles to the same player depending on the formation.

    dop2000

    Sorry for the confusion but how do I get the rows to swap rather than just the position, So if i pick 4-3-3

    rather than the players position changing I want to move the rows so the players positions dont change but their row is moved so 4-3-3 has 4 defenders so 4 players with the DF value will be moved to the front just under the GK rather than just changing the players.

    SO like its a football team and I want to arrange the players into a formation rather than swap their position values

  • Hi dop2000,

    There seems to be an error with your code

    Here is what the array looks like before the player chooses a formation:

    notice how the 2nd value ('richie machin') has a position which is GK

    Heres what the array looks like when they choose 3-4-3

    Now look you can see Richie machin's position has been changed - this shouldn't happen he should be moved to the bottom as he is another GK instead your code swaps a position with him. How can I fix this?

    dropbox.com/s/tpgt7i4qewufm25/V4.c3p

    This is not the only player this is happening to aswell please can you look into this. It seems to me that the only thing that changes in the array is the positioning not the players , how can I get this to move whole lines in the array

  • Hi Guys my name is Laurence,

    I have been using construct for many years now and am now available for work. If you would like to hire me join my discord server and we can go from there.

    I look forward to hearing from you!

    discord.gg/mXWgeRX

  • We've made about 20 games so far and have even been nominated for an emmy award! We're looking to make some more. Looking for people who can take a high level idea and run with it.

    everydayarcade

    Hi I'd love to work with you on this,

    I have completed many jobs for the construct community users.

    Please join my discord,

    I look forward to hearing from you!

    discord.gg/mXWgeRX

  • dop2000

    Thank you so much for your time and help - Sorry for the confusion I have got a working example now with all formations!

  • dop2000

    Thank you for the example

    I have now tried yours with a full team sheet,

    And it wipes every value except the positions,

    Please could you take a look at this and see where I'm going wrong:

    dropbox.com/s/3cfhb2h3hswisr7/ArrayProblem.c3p

  • 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=..
    
    

    dop2000

    I still cant get this working Please could you provide a .c3p file

  • 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"))

    dop2000

    Sorry I am still confused what would it be for the others and how would I keep the player with GK position at the top?

  • dop2000

    heres the link to the .c3p file I have

    dropbox.com/s/1rkpq15y5su094z/New%20project%20%281%29.c3p

    I changed Y to 1 to make it transfer the player names - But I still can't get as player with GK staying at the top whilst the formation is changed

  • dop2000

    The player names get lost in the transfer aswell how do I fix this:

    Also how did you know for the 3-4-3 its:

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

    How do I work that out for the others?

    Also the player with GK is supposed to be at the top except it puts the player with the DF at the top how can I start the DF players from the 2nd position?

  • 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
    

    dop2000

    Thank you

    - how would I do this for the other formations?

  • 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.

    dop2000

    here is a demo a colleague provided:

    Fill out the first name surname and email with random stuff it doesn't matter

    Then go to the squad screen

    and you should see the formations box

    This is what I'm trying to recreate. With the formation changes. Does this explain?

  • Sparsha

    When will extended and pro version be released - Also do you have a working example for creating an account and logging in with this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here you go:

    https://www.dropbox.com/s/bseax8wgh8yc95t/Array2DSort.c3p?dl=0

    dop2000

    Thanks for the response -

    How would I do this is if I had 18 players in the array and I only wanted to play 10 so I only arrange 10? And the rest of the players are sub and not in the team. 11 players are on but the GK alway stays at the top. How would I do this?

    With the formations: -- there would be a button where these can be changed

    4-4-2

    4-3-3

    3-4-3

    5-3-2

  • Hi Guys I have an array that contains football players name and position like this:

    Player name,Player Position

    Here is an example of one of the lines in the array:

    TestName,DF

    etc and I have 3 positions DF, MD and AT

    Each player will have one of those values

    How do I sort the array so that when the player chooses to sort the team into the formation for example

    5-3-2

    the first part 5 is DF

    the second part 3 is MD

    and the third part 2 is AT

    So it looks like this:

    DF,DF,DF,DF,MD,MD,MD,AT,AT

    How would I sort the array so that the 5 players with DF value are at the top then the 3 players with MD value are in the middle and the 2 players with AT value are at the bottom?