My events are not working

  • Hi,

    I'm trying to code the following:

    I have an 'show info' button at the top of the screen. When a player clicks on this it will make the text items with helpful information 'visible'. The button text then will display 'hide info' and when the player presses it, information will become 'invisible'. I can only get the first part to work, making things 'visible'. Is there something wrong with my events?

    My events are as follows:

    Button 1: On clicked

    & Button1 is instance variable=0 >>>>>> text item: Set visible

    & set Button1 instance variable=1

    Button 1: On clicked

    & Button1 is instance variable=1 >>>>>> text item: Set invisible

    & set Button1 instance variable=0

    If button1 instance variable=0 >>>>>>>Button 1: set text "show info"

    If button1 instance variable=1 >>>>>>>Buton 1: set text "hide info"

    it only works for the first part, whenever I try and enable the second part to 'hide info' nothing works.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Common mistake by new users is that they need to understand that all Events are run in one tick, one after another.

    So in your case, you test for a condition, change a variable, which makes the following condition valid, which resets the variable back again.

    Try using either sub Events or an 'Else' Condition.

  • Common mistake by new users is that they need to understand that all Events are run in one tick, one after another.

    So in your case, you test for a condition, change a variable, which makes the following condition valid, which resets the variable back again.

    Try using either sub Events or an 'Else' Condition.

    Can you give me an example?

  • Finally solved using this brilliant solution!

    scirra.com/tutorials/158/ve ... two-states

  • In that tutorial events #3 and #4 are executed on every tick, which is not very good. Also, there are several ways to toggle boolean variable in just one event, then event #2 will not be needed, for example: toggle=(toggle=0)

    Anyway, here is the right way to do this:

  • In that tutorial events #3 and #4 are executed on every tick, which is not very good. Also, there are several ways to toggle boolean variable in just one event, then event #2 will not be needed, for example: toggle=(toggle=0)

    Anyway, here is the right way to do this:

    For some reason 'Else' isn't working for me, it's showing as red.

  • "Else" should be at the same level as the condition (Button var=0) and there should be no other events between them.

    You can select the condition and press X, this will create an Else event for it.

  • "Else" should be at the same level as the condition (Button var=0) and there should be no other events between them.

    You can select the condition and press X, this will create an Else event for it.

    WOW !!!!

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