Advanced touch controls help!

Hello there!

As of now I'm trying to create touch controls for my game, that are supposed to work like Hectic Spaces ( https://itunes.apple.com/DK/app/id841199768 ). Heres a basic example:

Whenever I touch the screen, theres a difference of say 100 pixels, with your finger at 100 X and the player at 200 X. When you then move your finger to 150 then the players X goes to 250. If I then release my finger and put it somewhere else with a difference of say 50. My ship is at X 250 and my finger at X 300. I then slowly move my finger from 300 to 250 X and the player moves with it from 250 to 200 X.

If what I just said made NO sense at all, I would recommend trying out Hectic Space to understand what I mean. As of I now I have no idea of how to do it, my best guess so far has been (However not working): Constrain self.position.X to game.Touches.Touch 1.X - ( game.Touches.Touch 1.X - self.Position.X). If anyone could get me a solution or alternative way of doing touch controls I would be appreciate it a ton!

Thanks for read - Silver

Comments

  • jsorr2jsorr2 Member Posts: 279

    I'd need to be on my computer to figure it out, but a funny idea would be too copy paste your ship onto a huge blank image, and then put the image on the scene.
    So when anywhere is touched, the scene and the ship would move

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2014

    You might want to look at some of the swipe tutorials because they use the distance your finger travels to determine if a swipe has occurred. You would just need to use that same distance and apply it to the actor's position (e.g. via Interpolate). Start by Googling gamesalad swipe.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822

    @SilverAlmighty said:
    Whenever I touch the screen, theres a difference of say 100 pixels, with your finger at 100 X and the player at 200 X. When you then move your finger to 150 then the players X goes to 250. If I then release my finger and put it somewhere else with a difference of say 50. My ship is at X 250 and my finger at X 300. I then slowly move my finger from 300 to 250 X and the player moves with it from 250 to 200 X.

    In your actor make an attribute, call it ControversialAttributeNamingSchemeEntry098

    Then add a rule that says . . .

    When mouse button is down:

    Change Attribute ControversialAttributeNamingSchemeEntry098 to game.Mouse.Position.X - self.Position.X

    Constrain self.position X to game.Mouse.Position.X - ControversialAttributeNamingSchemeEntry098

  • SocksSocks London, UK.Member Posts: 12,822

    Example file.

    Link: https://www.mediafire.com/?j0ac15n4r6lcc09

    . . .

  • SocksSocks London, UK.Member Posts: 12,822

    Version with both X and Y coordinates:

    Link: https://www.mediafire.com/?poo3whserpmqnxd

  • SilverAlmightySilverAlmighty Member Posts: 17

    Thank you Socks! Its really amazing to see a community this helpful and dedicated!

  • ArmellineArmelline Member, PRO Posts: 5,366

    I won't go into how to do this, as @Socks has already answered that for you, but I will draw your attention to this bug: http://bugs.gamesalad.com/show_bug.cgi?id=473

    It will affect your game if you publish to iOS. The semi-fix I talk about in the report won't work for your usage, and I haven't found a way to actually fix it. I tell you all this just so if you encounter it you know it's a GS bug and not something you did wrong (probably).

  • SilverAlmightySilverAlmighty Member Posts: 17

    Thank you for the heads up @Armelline‌

Sign In or Register to comment.