Left right movement jamming.

Hi all, noob question so apologies if I seem a bit thick. I have created a basic left right touch activation on my first test project. Created it with two Boolean game attributes , which turn true on touch with an else statement to switch them back to false if not touched. This seemed to work at first but the attributes started to stick on intermittently in game whilst using viewer on iPad and iPhone. Any help appreciated in solving this

Comments

  • MentalDonkeyGamesMentalDonkeyGames Member Posts: 1,276

    Can you post a screenshot of your rules? It's much easier to help if we know exactly how you've set things up.

    Mental Donkey Games
    Website - Facebook - Twitter

  • Zebadey Zebadey Member, PRO Posts: 8

    Thanks for quick response, here are the rules for the right move, which is duplicated for the left

  • IceboxIcebox Member Posts: 1,485
    edited March 2016

    @Zebadey

    I usually do my movement this way ,

    2 game attributes Right and left booleans

    2 actors for right and left

    If touch is "inside"
    game.Right is true
    Otherwise game.Right is false

    If touch is "inside"
    game.Left is true
    Otherwise game.Left is false

    Try it I hope it works, there might be better ways but this works well for me.

    Edit: when you put the movement rules " inside " it gives smoother control.

    In your actor you can put it this way

    If game.right and game.left is false constrain motion linear velocity to 0

    Otherwise create two rules

    if game.right is true constrain motion linear velocity x to the number you prefer
    If game.left is true constrain motion linear velocity x to negative the number you prefer

  • mhedgesmhedges Raised on VCS Member Posts: 634
    edited March 2016

    What @Icebox said. Use "Otherwise".

    If touch is pressed
    Attribute "LeftButtonPressed" = true
    Otherwise
    Attribute "LeftButtonPressed"= false
    End If

  • IceboxIcebox Member Posts: 1,485

    @mhedges The problem with using pressed in movement buttons is that when you switch from right to left it sometimes gets stuck , so its better to use inside , cause some people swipe their finger tips to both sides instead of releasing the button. This happens more with movement touch buttons only , so using when touch is inside is much better.

  • mhedgesmhedges Raised on VCS Member Posts: 634

    @Icebox said:
    @mhedges The problem with using pressed in movement buttons is that when you switch from right to left it sometimes gets stuck , so its better to use inside , cause some people swipe their finger tips to both sides instead of releasing the button. This happens more with movement touch buttons only , so using when touch is inside is much better.

    Correct - I overlooked that focusing on the "otherwise". :)

  • Zebadey Zebadey Member, PRO Posts: 8

    Thank you all , solved it straight away. Wow you guys are good B)

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Also note you don't need that rule in the otherwise section. All you need is the change attribute this is why it was getting stuck. Touch is released is a permanent condition once executed unlike pressed, which is a momentary condition. So by removing the release rule you set that rule up like a switch.

    So if pressed condition will be true. If not pressed the condition will become false. The released rule messes with that process.

  • SocksSocks London, UK.Member Posts: 12,822
    edited March 2016

    @Zebadey said:
    Hi all, noob question so apologies if I seem a bit thick. I have created a basic left right touch activation on my first test project. Created it with two Boolean game attributes , which turn true on touch with an else statement to switch them back to false if not touched. This seemed to work at first but the attributes started to stick on intermittently in game whilst using viewer on iPad and iPhone. Any help appreciated in solving this

    You can do this with a very straightforward rule . . . in your actor's Motion attributes set the LinearVelocityX to 200, then have a simple rule that says:

    When touch is pressed
    Change LinearVelocityX to -LinearVelocityX

Sign In or Register to comment.