Why does the event brokes?

0 favourites
  • 5 posts
  • I want player to buy kielbasa from the store for 500zl. When he does it, layer with kielbasa being visible, +1 kielbasa adds to the kielbasa global value. When player buys it again, another layer with kielbasa being visible, ect. Everything works with 500zl, but if you will buy it when you have 1000+ zl, you will instanly buy 2 kielbasas and the money system dies. What I did wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is a common mistake. Don't break everything out into separate events, try to group them in a tree. The problem is when event 15 runs, you add one to Kielbasa. Then event 17 runs, sees that Keilbasa is 1 so adds another one, and again in event 18! Break the Keilbasa checks into subevents using Else, so only one gets evaluated at a time.

    On-touch

    Layer 6 visible

    Zloty>=500

    --> Keilbasa=0

    -->else

    --> Keilbasa=1

    -->else

    --> Keilbasa=2

  • This is a common mistake. Don't break everything out into separate events, try to group them in a tree. The problem is when event 15 runs, you add one to Kielbasa. Then event 17 runs, sees that Keilbasa is 1 so adds another one, and again in event 18! Break the Keilbasa checks into subevents using Else, so only one gets evaluated at a time.

    On-touch

    Layer 6 visible

    Zloty>=500

    --> Keilbasa=0

    -->else

    --> Keilbasa=1

    -->else

    --> Keilbasa=2

    I can't add Else

  • Select the event (not just the condition), right-click->Add->Add 'Else' (or select the event/condition and press X).

  • Select the event (not just the condition), right-click->Add->Add 'Else' (or select the event/condition and press X).

    It's worked, thanks

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