How do I overlapping once and random number in object

  • Hi! I'm Luca from Italy. I'm sorry for my English, I'll try to be clear!

    I'll insert my file .capxI've got two problems:

    1) I've been following some instructions in a construct tutorial about once overlapping. When I pass on a black block two o more times, the trigger doesn't work and the counter signs other points. I need that one time overlapping, others steps on black block don't add more values to points.

    2) My second problem is that random number is generate always the sprite overlapping black block. I need instead that the random number is created one times when System create an object, see image below.

    Thank you and sorry for my English. I've been studying to 2 years!

  • Hello

    I'm not sure what you are trying to do, but I try to help you out.

    1) What do you want to achieve with the 'which' variable? It is always 1, so your code at 'which = 0' will never be called.

    2)

    Just use 'On created block' and add your actions.

  • I'm also not sure what you are asking but event 3 will always return 0. Use either floor(random(2)) OR choose(0,1).

  • Hello

    I'm not sure what you are trying to do, but I try to help you out.

    1) What do you want to achieve with the 'which' variable? It is always 1, so your code at 'which = 0' will never be called.

    2)

    Just use 'On created block' and add your actions.

    Hi! thank for your answer!

    1) I've erased others code for example, at the begining there was others generator block like as which = 1 generated red block, which = 2 generate blue block etc..

    2) I've insert my action as generator random numbers in "on create object", but it is generate always I overlapping on black block. I need that the random numbers are generated one time for each blocks.

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm also not sure what you are asking but event 3 will always return 0. Use either floor(random(2)) OR choose(0,1).

    Hi! thank for your answer!

    I've erased others code for example, at the begining there was others generator block like as which = 1 generated red block, which = 2 generate blue block etc..

    Thanks

  • Hi! Nobody can help me?

    I've used to trigger for overlapping but when I pass on same object overlapping works again.

    I need that overlapping generate one event, others overlapping on the same object doesn't have to generate any others events.

    Have a good day

  • Hi! Nobody can help me?

    I've used to trigger for overlapping but when I pass on same object overlapping works again.

    I need that overlapping generate one event, others overlapping on the same object doesn't have to generate any others events.

    Have a good day

    Just add a variable 'overlapped' = 0.

    Condition

    On overallping && overlapped = 0

    Action

    Set overlapped to 1

    YOUR CODE

    Regards

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