How i do correct order in my game?

From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • I create a mini game who appears X text numbers in the screen with a global variable, for example i put 10.

    Then i need to touch in correct order, 1 to 10 or 10 to 1, but i try some kinds of behaviorus but it doesnt works.

    For example, i put a global variable called up or down, and try to the conditional int he game but nothing,

    Some ideas???

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"variable","name":"cantidadnumeros","type":"number","initialValue":"10","comment":"","isStatic":false,"isConstant":false},{"eventType":"variable","name":"descendente","type":"number","initialValue":"10","comment":"","isStatic":false,"isConstant":false},{"eventType":"block","conditions":[{"id":"on-start-of-layout","objectClass":"System"},{"id":"repeat","objectClass":"System","parameters":{"count":"cantidadnumeros"}}],"actions":[{"id":"create-object","objectClass":"System","parameters":{"object-to-create":"NUMEROS","layer":"0","x":"random(LayoutWidth)","y":"random(LayoutHeight)"}}]},{"eventType":"block","conditions":[{"id":"on-created","objectClass":"NUMEROS"}],"actions":[{"id":"set-text","objectClass":"NUMEROS","parameters":{"text":"cantidadnumeros"}},{"id":"subtract-from-eventvar","objectClass":"System","parameters":{"variable":"cantidadnumeros","value":"1"}}]},{"eventType":"comment","text":"EVENTO CUANDO SE TOCA EL NÚMERO CORRECTO"},{"eventType":"block","conditions":[{"id":"on-tap-object","objectClass":"ControlTáctil","parameters":{"object":"NUMEROS"}}],"actions":[{"id":"destroy","objectClass":"NUMEROS"},{"id":"play","objectClass":"Sonidos","parameters":{"audio-file":"Acierto","loop":"not-looping","volume":"0","tag-optional":"\"\""}}]}]}Code.Value

  • I did a demo for you:

    This is ascending form 1 to 10

    Capx: https://www.dropbox.com/s/ew42agxcocezifo/sequence%20order.capx?dl=0

    If you need to do the descending 10 to 1, you just need to put the Global 11 and then do the opposite which is subtracting instead of adding

    I hope it helps

  • Thanks a lot, i put the idea into my game and works, then i try to put the loot into a variable for the options, who the player choose how many numbers could get into the screen.

    Now im trying the number doesnt appear in the border of the screen, and appear together,

  • I put this for the object, in this case ist the numbers into de border of the screen.

    But the numbers are above one each other, and i dont wanna this. How i could do that?

    Thanks again

  • Not sure if I understood correctly:

    But for what I see in your events is that you trying to spawn at random Position and that they don't overlap also you trying to avoid spawning on the borders of the Screen ViewPorts

    If it's that what you trying to do then:

    Here is an Example:

    Capx: dropbox.com/s/axlctj8rr1kvusa/sequence%20order2.capx

    Note:

    Be careful don't spawn too many objects on small spaces or the While Loop it will cause an infinity loop because it will not be able to find spaces to places the objects without overlapping. So always make sure whatever quantity of objects you are spawning they have plenty of space to spread out without overlapping.

    Here 100 objects is ok as it loads fast, the more objects you put the more it will take to load as it needs time to spread the objects so they don't overlap.

  • Yea more or less is want i need.

    SEe my image:

    Is that, i see you put the frame for have overlaping, but with text isnt exist.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Beekiller

    Sorry for late replay I didn't receive any notification

    If you mean that you don't need the Frame?

    Yes, the text objects don't have the overlap check condition but you could use just one frame to do the overlap check then just delete it at the end.

    https://www.dropbox.com/s/wdnq21blo4gsc7a/sequence%20order3.capx?dl=0

  • Great idea!!!!! Thanks a lot for helping me.

  • Iam learning a lot, but i could do some kind, but i have some idea, if we hace a table with 10x10 we have the numbers with order.

    If i change the px of the text i put more big always the numbers is overlap.

    Could be exist something to change?

  • Iam learning a lot, but i could do some kind, but i have some idea, if we hace a table with 10x10 we have the numbers with order.

    If i change the px of the text i put more big always the numbers is overlap.

    Could be exist something to change?

    Not really sure if I understood correctly

    It would have been quicker if you posted your Demo project as every case it's different and it will be done differently.

    If you have already fixed grid size like 10x10 then you will not need to do overlap checks, just spawn in order and leave the spaces between Txt (Width/Height)

    or

    If you talking still about using the Frame to test overlaps, then before the loop starts you need to make the Frame size as big as the biggest txt object that you will have (Width/Height) and that should be enough, by doing this it will automatically leave enough spaces for all the Txts instances.

    If it's not what you looking for please post your capx and explain a bit more and I will have a look

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