How do I get this pattern to work?

0 favourites
  • 5 posts
  • I am aiming to get two variable combinations to give me specific output in a linear way. I am taking 5x5 combination of values without repitition and need the output to be incremental by 1 on each step as follows:

    (1,1) = 1

    (1,2) = 2

    (1,3) = 3

    (1,4) = 4

    (1,5) = 5

    (2,2) = 6

    (2,3) = 7

    (2,4) = 8

    (2,5) = 9

    (3,3) = 10

    (3,4) = 11

    (3,5) = 12

    (4,4) = 13

    (4,5) = 14

    (5,5) = 15

    Can someone help me out with this?

  • Global number a=0

    Global number b=0

    Function “n”

    — set a to min(function.param(0), function.param(1))

    — set b to max(function.param(0), function.param(1))

    — set return value to a+10-(5-b)*(6-b)/2

    For the same range of numbers you have at least.

  • Global number a=0

    Global number b=0

    Function “n”

    — set a to min(function.param(0), function.param(1))

    — set b to max(function.param(0), function.param(1))

    — set return value to a+10-(5-b)*(6-b)/2

    For the same range of numbers you have at least.

    This one does not seem to be giving the proper values for the given set either. Min and max logic seems good but the return value it gives seems to have a different formula

  • Switch a and b in the formula. I made a mistake writing it down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Switch a and b in the formula. I made a mistake writing it down.

    Thanks! It worked! :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)