8 Direction for Mobile

Post » Mon Apr 10, 2017 10:57 am

Is there an easy way to use 8 Direction behaviors with Mobile devices? For example, swiping left causing the 8 Direction to behave as if a left arrow were pressed.
B
16
S
5
G
3
Posts: 30
Reputation: 2,245

Post » Mon Apr 10, 2017 11:11 am

YOu can create a dummy sprite at the point you start to touch, and compare angles between that starting point and your touch point. Then simulate pressing the key for that angle.
Follow my progress on Twitter
or in this thread Archer Devlog
B
40
S
17
G
17
Posts: 980
Reputation: 12,632

Post » Mon Apr 10, 2017 4:56 pm

tgenedavis wrote:Is there an easy way to use 8 Direction behaviors with Mobile devices? For example, swiping left causing the 8 Direction to behave as if a left arrow were pressed.


There's not an easy way until a built in behavior for this is supported in C3. Here's a tutorial that should help you make controls for touch screens.

https://www.scirra.com/tutorials/398/to ... ers/page-1

There are other tutorials too and examples in the "How to" forum. I'm not sure which one I linked to, but one of them allows you create the dpad anywhere the user first touches. I think that is the best option.
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Tue Apr 11, 2017 12:09 pm

Oh, good. I was hoping I wasn't making a simple mistake. The feature just isn't there.
B
16
S
5
G
3
Posts: 30
Reputation: 2,245

Post » Tue Apr 11, 2017 6:43 pm

Don't call it a feature request as this is just a display of skills and knowledge in making games with Construct. Certainly, not a mistake either on your part.

There is a never ending request for this kind of request and eventually you realised what you need might as well be asking for a template for a particular game made by another fellow Construct user who has better skills and knowledge.
B
40
S
9
G
5
Posts: 177
Reputation: 6,805

Post » Thu Apr 13, 2017 3:56 pm

I asked if they would add swipe gestures to the built in touch behaviors, and I think that would work great for this, but they ignored my questions about it. Even made a thread asking about it before the suggestion system was created. No Answer.

Seems like a no-brainer to me, since most people now browse the web on mobile devices like phones and tablets. Even PC's have touch screens. I would think that a company that has so much invested into the future of the web, would see that, and would already have these features built in to make it easier for all of us. :?
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Fri Apr 14, 2017 3:15 pm

Moot wrote:I asked if they would add swipe gestures to the built in touch behaviors, and I think that would work great for this, but they ignored my questions about it. Even made a thread asking about it before the suggestion system was created. No Answer.

Seems like a no-brainer to me, since most people now browse the web on mobile devices like phones and tablets. Even PC's have touch screens. I would think that a company that has so much invested into the future of the web, would see that, and would already have these features built in to make it easier for all of us. :?


Have you tried "compare touch speed"? I can already make a fruit ninja game with that.

To answer OP's question:
Your example is a little vague. Does the player hold down after a swipe? Or just swipe and the game character will keep walking in that direction?

There is always the "Pin" behaviour to make a virtual console. Just pin the controller as "rope" to a fixed sprite and also give it a "drag and drop" behaviour. Check between angles for different directions. When touch is released, reset controller position to fixed sprite. This is as simple as it gets IMO.
B
40
S
9
G
5
Posts: 177
Reputation: 6,805

Post » Fri Apr 14, 2017 5:27 pm

Jaydon wrote:Have you tried "compare touch speed"? I can already make a fruit ninja game with that.


I don't think I have, but I already found what works best for me. I basically use a floating analog stick for 8 direction movement.

I think this is the tutorial I used, but since adapted it for personal use:
https://www.scirra.com/tutorials/398/to ... ers/page-1
B
16
S
7
Posts: 190
Reputation: 1,823

Post » Mon Apr 17, 2017 11:09 am

tgenedavis wrote:Is there an easy way to use 8 Direction behaviors with Mobile devices? For example, swiping left causing the 8 Direction to behave as if a left arrow were pressed.


I have found that the easiest and most intuitive way to do 8-direction on mobile is to just use a 3x3 grid of invisible buttons:

upleft / up / upright
left / stop / right
downleft / down / downright

Logic:
Is Touching Object (upleft) -> simulate 8-direction "up", simulate 8-direction "left"

Visuals:
-Make each of the buttons in the 3x3 grid invisible.
-Overlay a joystick background (a large colored circle will work) that is stationary and covers all 9 of the invisible buttons.
-Overlay a joystick (a smaller colored circle) that starts at the location of the background, and changes its location by about 10 pixels toward the direction of whatever button you are pressing.

I have had less luck with more complicated joysticks. Dragging/swiping controls have always seemed a bit finicky to me.
www.simbucket.com - HTML5 Science Simulations / https://www.airconsole.com/#!play=com.n ... obotrumble - Robot Rumble on AirConsole
B
48
S
14
G
24
Posts: 402
Reputation: 16,652

Post » Mon Apr 17, 2017 6:51 pm

cjbruce wrote:
I have had less luck with more complicated joysticks. Dragging/swiping controls have always seemed a bit finicky to me.


It would definitely be nice to have some swiping behaviors built in. I'm always looking for a better way to do things. Maybe Scirra can have a contest on who can build the best swiping controls and then add that officially to C3? It would give someone some bragging rights that they created a behavior that was adopted by C3. :D
B
16
S
7
Posts: 190
Reputation: 1,823


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests