Need help with touch movement...
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
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
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?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
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?
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.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@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...
Ok, the collision problem is fixed using this tutorial:
http://gshelper.com/shop/advanced-game-functions/constrain-to-mouse-and-keep-collision-gamesalad/
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?
You will need to post a demo of the problem so we can see it in action.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
Sorry, is there a way to directly upload/attach a file? ;-)
Zip/compress it and use the the "Attach image/file" drop down on the top right of the comment box.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@colander
I saw that... but it's requesting an url – so i have to upload it somewhere first, haven't i?
You can choose a file from your computer or drag and drop to it. I have never used the image url.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@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....!?
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.
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.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@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.
@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.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@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.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
@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.
@Rohal -- here is one way to do it. (There are probably several other ways.)
@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.)