Me Dumb You Smrt

0 favourites
  • Can anyone start me off on some Ideas of how to make a "Touch" slider. ie. If the player runs their finger across the screen from left to right or VV. the background scrolls and advances forward. Somewhat like those ipad childrens apps from Disney.

    Strange I know for games. Though could be sweeeet. Thanks! Construct 2 is amazing.

  • that VV is vice versa. haha

    • on touch you store the touch.X in a 'startX' variable
    • while you have your finger on the screen you calculate the offset like touch.X-startX
    • then you scroll the display by this amount

    I did that to mimic a panning by middle clicking+drag.

    It's the exact same idea.

    Panning.capx

  • Ah this is helpful. I owe you cookies! Thanks.

  • This is what i did with it. Thanks! Helped out perfectly. Wanted to restrict it to the X too

    knowfollowers.ca

    Click the link, see what ive done.

  • oh! right click ok

    nice (:... maybe the moon should go behind the text 'cause it's pretty close in values and it blends a bit too much with the title. So either way from the center, either a bit darker (:

  • cant seem to keep the title centred on all devices but meh, thanks for the help! The moon is now out of the way haha

  • Lovely ! But how do I turn it to work on touch device ?

  • Laurent

    Just change the click references by touch references.

    I already turned it for touch, but i'm not on my computer right now.

    I'll upload it tomorrow if you don't figure it out.

  • That would be great, Septeven. I tried to but didnt manage to deal with the variables.

  • Laurent

    Here is the capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey Stepteven,

    Thanks a lot, this is amazing how it works !

    I just have a problem : I have drag/drop objects on the layout and when I touch and move them, the layout is panning as well. Is the a way to prevent that ?

    Thanks again !!

  • PS : i was thinking about placing draggable object in a Family and when this family is touched, Dragging=0

    But I need scrolling to occur again when draggable object reach the edge

  • add a "is touching" 'or' condition to "Is not in touch" condition as this :

    Touch X Is in touch
    [b]or
    Touch Is touching "object"[/b]
    --> System - Set dragging to 0
    --> Set sSX to scrollX
    --> Set sSY to scrollY

    And use "@" before a username ("@septeven") to send an alert to the user.

    Because I may not see your answer though.

  • That's what I did and it worked !

    But I can't figure how to allow scroll again when objets slides down ans scrolling is still possible.

    Another last thing, I'd like to add a little inertia to the scrolling movement

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