8 Direction for Mobile

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • Oh, good. I was hoping I wasn't making a simple mistake. The feature just isn't there.

  • 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.

  • 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.

  • 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.

  • 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

  • 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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)