Need help with touch movement...

RohalRohal GermanyMember Posts: 62

Hi!

I'm testing for many hours now, how the get the perfect touch control for my actor.
But i'm still not happy with it. I also watched many tutorials but none of them covered what i'm looking for...

Maybe somehelp can point me to another tutorial or support me with an idea.

What i like to build:
It's some kind of touch movement – but no drag & drop.
If i touch somewhere on the left half of the screen and keep my finger down. The movement of my finger is translated to the actor. It' doesn't matter where on the left side of the screen i start the control (by touching) of the actor.

The idea is that a small movement of my finger is enough to move my actor from one side to another, so there's no 1:1 translation of the movement.

I don't want the need to cross the whole screen (the half screen) with my finger to move to actor.
So there is the need of a very direct transfer of the movement from my touch gesture to the actor, but that's not a classic drag & drop...

I hope anyone understands what i am talking about! ;-)
It would be easier to explain it in german.

Any help is welcome.
Thanks in advance.

Rohal

Comments

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

    So it sounds like you want the player to drag their finger across the left half of the screen and the distance they drag is the distance that the actor moves. So if they drag from x=100 to x=300, the actor would move to the right 200 pixels (300 minus 100). And they don't have to touch the actor at all to have this work. Correct? And do you want the movement of the actor to occur during the drag or after the drag has completed and the player has lifted their finger?

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

  • ArmellineArmelline Member, PRO Posts: 5,369

    @tatiang said:
    So it sounds like you want the player to drag their finger across the left half of the screen and the distance they drag is the distance that the actor moves. So if they drag from x=100 to x=300, the actor would move to the right 200 pixels (300 minus 100). And they don't have to touch the actor at all to have this work. Correct? And do you want the movement of the actor to occur during the drag or after the drag has completed and the player has lifted their finger?

    He seems to be saying that he wants to be able to perform a small drag of the finger across the bottom and for that small drag to move the actor a larger distance. Perhaps something like 1:5?

  • RohalRohal GermanyMember Posts: 62

    Armelline is right. The movement of the touch gesture is not 1:1 transfered to the actor.
    The idea is to use a (very) small area to move the actor from left to right.

    And the movement should be very direct. So every move of my finger must be transfered to the actor adhoc.

    The method tatiang mentioned, doesn't work for me. It wasn't responsive enough and the needed touch area was to large.

    Is ist possible to start some kind of drag & drop without touching the actor himself and transfer the touch movement with a 1:5 ratio?

  • colandercolander Member Posts: 1,610

    I hope I understood your question correctly. I have attached a project showing one way to do this. It moves the hero on both the X and Y axis. You can easily change it to work on either the X or Y axis only. This could also be done using Touch 1 and magnitude.

  • RohalRohal GermanyMember Posts: 62

    @colander‌
    Thanks for your help.... this is definitely going into the right direction.
    I switched the axis and spawn the "trigger" on touch.

    I put a border around the scene and added two collide statements. Collide doesn't work at the moment and i wonder why. Is that because of the "drag & drop" we're doing.

    And i wonder if it's possible the have some kind of "slow out" - so if i stop the movement (touch is no longer pressed) the actor should keep moving in the last direction for a few pixels...

  • RohalRohal GermanyMember Posts: 62
  • RohalRohal GermanyMember Posts: 62
    edited July 2014

    I had to change to "self.Motion.Linear.Velocity" to get the collide work properly.
    But now my movement behaves not that good as before... :-(

    Is there another way to keep the collide working?

  • colandercolander Member Posts: 1,610

    You will need to post a demo of the problem so we can see it in action.

  • RohalRohal GermanyMember Posts: 62

    Sorry, is there a way to directly upload/attach a file? ;-)

  • colandercolander Member Posts: 1,610

    Zip/compress it and use the the "Attach image/file" drop down on the top right of the comment box.

  • RohalRohal GermanyMember Posts: 62

    @colander‌
    I saw that... but it's requesting an url – so i have to upload it somewhere first, haven't i?

  • colandercolander Member Posts: 1,610
    edited July 2014

    You can choose a file from your computer or drag and drop to it. I have never used the image url.

  • RohalRohal GermanyMember Posts: 62

    @colander‌
    I never thought that i would be that stupid, but it doesn't work for me.
    Maybe that's a Pro Feature. As soon as i drag the file onto the "Attach image/file" dropdown it is closing and the browser starts to decompress my file. I tried it with Firefox and Chrome... with no success....!?

  • RohalRohal GermanyMember Posts: 62
    edited July 2014

    So, i uploaded the file to GoogleDrive.
    https://drive.google.com/file/d/0B2wmfAS0xy3Hc3M4NV9idWkzZUk/edit?usp=sharing

    The example based on your file and shows what i'm trying to archive.
    It's a very direct movement with full controll. The bad thing is, that there is no collision management. I read in the forum that this doesn't work with contstrain.

    So i switched to the use of Velocity which keeps the collide but ends in a different way of movement control.

    You can switch these two mechanisms in the actor "Hero". (Method: Velocity and Method: Position)

    Does anyone have an idea how to get the movement more like the method which uses the position - but keep the collision detection?

    Any help is appreciated.
    Thanks in advance.
    Rohal.

  • colandercolander Member Posts: 1,610
    edited July 2014

    I am a bit pressed for time at the moment, I will try and get to it as soon as I can.

    EDIT: Removed information which has already been mentioned earlier in this thread.

  • RohalRohal GermanyMember Posts: 62

    @colander‌
    That's the tutorial on which the Velocity Method in my example file is based...
    Sadly that's resulting in a complete different steering experience...

    Thanks for your help.

  • colandercolander Member Posts: 1,610
    edited July 2014

    @Rohal Ahh! got myself confused been in too many threads to keep track. I edited my post so it doesn't confuse others.

    I got your project file from Google, before you tried to load it here did you compress it? It wont upload if you don't.

  • colandercolander Member Posts: 1,610

    @Rohal ok I have had a bit more of a look. While it is most likely possible to do what you want it is going to take me some time to figure it out. I don't want to start because I don't know how long it will take for me to find the solution if at all.

    If someone else doesn't pop up with the answer you will have to keep experimenting until you crack it or redesign this piece of your game.

  • RohalRohal GermanyMember Posts: 62

    @colander‌
    Thanks for your help anyway. I don't want you to bust your head because of my problem.
    Maybe i find another way to do what i want.

    If anyone else has some hints for me – help is appreciated.
    Thanks in advance.

    Rohal.

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Rohal‌ -- here is one way to do it. (There are probably several other ways.)

  • RohalRohal GermanyMember Posts: 62

    @RThurman‌
    Wow - that looks awesome! Thanks a lot!
    Just for understanding ... what is it's secret? I Thought collide and constrain doesn't work together?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Rohal said:
    RThurman‌
    Wow - that looks awesome! Thanks a lot!
    Just for understanding ... what is it's secret? I Thought collide and constrain doesn't work together?

    You are welcome. I hope it works for you!

    I guess the 'secret' is to not use constrain attribute behaviors if they interfere with or override GameSalad's built-in physics engine.

    For example, constraining an actor's X,Y coordinates will not allow the physics engine to place actors where they should go.

    But you can use 'constrain attribute' to adjust all sorts of other attributes that don't directly override or interfere with an actors placement, movement, rotation, or size.

    (Its the same for using interpolate behaviors. Don't mess directly with physics and everything will work fine.)

Sign In or Register to comment.