How do I change a text on another layout

0 favourites
  • 12 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Hi, so I have 2 layouts, and one has a button on it and the second one has a text object on it.

    I have an event that says "on click" of the button, "go to layout 2" and "set texto bject's text to 12345"

    It goes to the layout, but the text never changes.

    If I put the text object on the same layout as the button, it does work.

    What am I missing ? It seems pretty straight forward, but...

    Thanks

    saludos

  • You're having it go to another room and then trying to set text, which doesn't work. If you want to set a line of text in the next layout you'll have to do it with a global variable or set the line to change in the second layouts event sheet(again either with a global variable or hard coded).

  • Make a global variable called "clicked" initial value=0

    When button on layout1 is clicked,

    -Set global variable "clicked" to 1

    On start of layout2,

    "Clicked" =1

    -Set text to what ever.

  • Oh, I will try that.

    Why is it that an event triggered in a layout can't perform an action that changes an object on a different layout ?

    Thanks

    saludos

  • Usually the event sheet in one layout does not affect the other.

  • But you can still have 2 layouts share an event sheet, and events work on both layouts just fine.

    The problem only appears when an object on one layout is the trigger and an object on another layout is affected by the action triggered.

    saludos

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But you can still have 2 layouts share an event sheet, and events work on both layouts just fine.

    The problem only appears when an object on one layout is the trigger and an object on another layout is affected by the action triggered.

    saludos

    You noticed well

  • The problem only appears when an object on one layout is the trigger and an object on another layout is affected by the action triggered.

    saludos

    That's because a trigger event works just once.The actions in it are executed as soon as it triggers.

    Think.......

  • Still don't understand, if a click is the trigger , why does it matter if the text to be changed is on layout 1 or layout 2, as long as both sahre the same events sheet ?

    saludos

  • Still don't understand, if a click is the trigger , why does it matter if the text to be changed is on layout 1 or layout 2, as long as both sahre the same events sheet ?

    saludos

    Have you tried that?(Both having the same layout?)

  • > Still don't understand, if a click is the trigger , why does it matter if the text to be changed is on layout 1 or layout 2, as long as both sahre the same events sheet ?

    >

    > saludos

    >

    Have you tried that?(Both having the same event sheet?)

  • Oh yeah if the event trigger and the object affected by the event are on the same layout everything is ok.

    saludos

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