Mobile Thumbstick- AKA touch control, multiplayer

Get help using Construct 2

Post » Sat Nov 17, 2012 2:52 pm

@jaderyu

Interesting input!
I too, don't like the fact that using drag and drop means I have to retouch- and re-drag the thumbs from the center position every time I accidentally drop it.
(If I learn how to do the thing I asked on previous post, I would change the touch control into calculating angles between "Control" and "Touch" right away)

I opt using "is not dragging" over "on drop" in order to have the thumbs position on the center of the touch pad on the start of the layout, and in case that it was dislocated from the touch pad for whatever reason.

I always wonder though, if an event is always true, does it makes the event always firing?

for example as you say, when I use "when thumb is not dragging, set position of thumb to control", does the construct doing work reposition thumb to control every tick, taxing performance?
B
12
S
4
G
4
Posts: 64
Reputation: 4,014

Post » Sun Nov 18, 2012 7:33 am

@ZhaoYun

I don't think this would be a good place to discuss this, otherwise it'll turn into a massive thread.
Do you have an email that we could use?

But to answer the question put forward.
I don't see anything wrong with it. It seems all right to me, if there is something that I'm missing could you care to elaborate.
Also, there is a much easier way to do this, I can give you a capx if you want.
B
18
S
9
G
5
Posts: 77
Reputation: 4,946

Post » Sun Nov 18, 2012 9:48 am

"for example as you say, when I use "when thumb is not dragging, set position of thumb to control", does the construct doing work reposition thumb to control every tick, taxing performance?"

if an event condition is true. Then it always fires. So in the example the position of the thumb is set to the control position every tick.

Is it taxing performance? Not really. It's only one instruction. however it's a good rule of thumb to watch for this. It's possible that you only need an event to fire once(as above sample only needs to be fired once), but may have dozens of intensive instructions. This could tax and reduce performance.


I think it's awfully thought for loneman to offer his time to teach some intracacies of C2. I personally am still muddling my way :D that's why I loved you drag and drop sample. Didn't even occur to me. jayderyu2012-11-18 09:49:43
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Sun Nov 18, 2012 10:05 am

@jayderyu
Thanks for the explanation~

Although I know about the always firing thingie, but I always wonder if there is an exception in some cases. haha. Good to finally get clarified.
B
12
S
4
G
4
Posts: 64
Reputation: 4,014

Post » Mon May 06, 2013 2:48 pm

[QUOTE=jayderyu]
First I wanted a larger area of input for where the thumb can start pressing graphically. the entire Touchpad area. I found making the control stick the same size had a draw back. The drag and drop feature follows where the object was grabbed. This resulted in a problem that even if I wanted to do a double tap I needed to "grab" the center each time. Where as tapping the side of the pad twice was ideal. The solution right now is to what seems a mandatory third event.
[/QUOTE]

@jayderyu
have you tried to increase the size of the collision mask to make a larger area of input? It's often used in mobile games.
B
23
S
6
G
5
Posts: 132
Reputation: 4,487

Post » Mon May 06, 2013 3:53 pm

@philx bit of an old thread :P I think this was back when using the Drag and Drop behaviour was required. So going over this.

"The drag and drop feature follows where the object was grabbed."

This would mean that when touching the object. The object will not center on where the touch occurred. So even increase the collision mask which is no different than effect of a different sized sprite. Will result in no control. Also with all of that. If you manually set the position of D&D object while dragging. The object will end up going screwy by constantly being re-rendered in two different locations on alternating ticks.

Now of course this was 6 months ago. I'm not sure if the D&D behaviour has any kind of changes. Maybe there is now an option that will snap the D&D to the point of touch. Which would make your point of increasing the collision mask work.

These days however Touch.touchID has been added and the use of D&D is not required. Since we are not using the D&D grab and drag where touching. We have the option to manually move the object without anything going screwy. So increase the collision mask will have perfectly fine results. There usually is no one solution. Just keep in mind that collision mask is the only part of the sprite that touch matters. Not the image of the sprite. So a larger collision is no different than a larger sprite. except for the size of the image :)

I found as long as the trinity of Events are met. I haven't seen any problem with implementation, but I could be over looking something :)

If your interested for how to do touch based joysticks there is a tutorial you can search for :)

https://www.scirra.com/tutorials/398/touch-stick-controllers
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Previous

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests