How do I prevent actions from being skipped?

  • I was creating a scroll box with the touch plugin, when I copied and pasted the code to my game. For some reason the scroll box was not working in my game. I eventually worked out that it was the event shown below, as the large project perhaps meant that the touch angle and touch speed where not being stored, instead displaying 0.

    Then I realised that the code probably shouldn't work anyway, as when you remove your finger from the screen, then there isn't any touch speed or angle. So I changed the code to that shown below:

    This works in my project, the only problem is, it stops working when there is a lot going on. To test this I made another project which has a large array that is looped through every tick. After pasting the code shown above, again the engine returns 0. I'm not sure why this is happening, and would like to prevent it as I don't want my game to stop working on slower devices.

    The full code that I tested is shown below:

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok I realised what the problem was. It wasn't working when I used the on drop event but it is working when using on any touch end.

    I assume this is because the drag and drop behaviour on drop is checked after the on any touch end event. Meaning that by the time the on drop is checked, there is no touch instance to compare. Having said that, doing it the way shown in the image below does work if there is little CPU utilization, but stops working at a certain point.

    The other way works at higher CPU utilization but again, stops working but at a much higher threshold:

    For my project I'll just use on any touch end as it seems a bit more robust.

    Edit: this is a known part of construct and is reported here: github.com/Scirra/Construct-3-bugs/issues/3718

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