What am I doing wrong here? Text object allways returns 111, even thou it should be touch.x.
If I put the "Set text to Variable1" right after I change the variable. Text object displays the touch.x
You can not use a Local here. It needs to be Global. "On touch" is a trigger, which happens outside of the event loop, so the scope only lasts for event 2. Events 3+ run on the next tick, which will reset the Local back to it's default of 111.
blackhornet
Thank you very much for clarifying this out. So does this mean that we can't change local variables with triggers?
You can change local variable, but they work in specific scope of events and when that scope ends local variable is automatically reset.
Read here to get more info about local variables https://www.scirra.com/manual/83/variables
You can set local variables to "static" so their value persist.
Develop games in your browser. Powerful, performant & highly capable.
shinkan Magistross
Thank you very much. This was a great help!