Tululoo: Analog Control extension (updated)

Today I've updated my Tululoo example for analog controls.
If above image isn't very illustrative, these are small on-screen circles, that can be used in applications and games to convert user input from on-screen coordinate to a vector.
In contrast to not very documented example that I've made last spring, this is now presented as an extension.
That has detailed documentation, quite cleaner structure, and more functionality (for example, now it's possible to check if a specific analog control element was pressed, similar to keyboard keys).
As one can probably guess, it also handles touch input on mobile devices accordingly, allowing multiple controllers to be interacted with at once.

Download (extension + example)

Related posts:

4 thoughts on “Tululoo: Analog Control extension (updated)

  1. I realize this post is about a year old, but I could use some help with this extension. How do you use walls with this type of player control? Using a collision with;

    x = xprevious;
    y = yprevious;

    causes the player to ‘stick’ to the wall, so you can’t really slide along a wall or move down narrow corridors. I asked about this in the Tululoo forums, and silentworks recommended using a place_meeting step, but that too causes glitchy behavior. Obviously, the problem with both methods is that there’s always some amount of ‘x’ and ‘y’ motion, unlike D-pad control which is isolated to individual directions.

    Have you had any luck using walls? Thanks!

    • In the simplest case you would want code of kind

      var nx = x, ny = y;
      x = xprevious;
      y = yprevious;
      if (!place_meeting(nx, y)) x = nx;
      if (!place_meeting(x, ny)) y = ny;

      For proper collisions, though, you indeed would need to do two loops to move object both horizontally and vertically to contact positions. Rounding coordinates upon movement or picking smaller steps would fix the “glitchiness”.

Leave a Reply

Your email address will not be published. Required fields are marked *