Moving custom slider horizontally only with gamepad? (Example CAPX)

0 favourites
  • 6 posts
From the Asset Store
Puzzle - Connect all dots using a single line horizontally and vertically without overlapping other dots.
  • I have a custom slider (credit dop2000) that i can use the touch control with to move and wanted to have the option of using a gamepad to control it. I have a custom cursor that i'm able to control using the analog sticks and want to use that to drag the slider.

    I've more or less got the basics of this working, where i'm able to drag the slider using the gamepad by having the slider pin to the cursor when the cursor is overlapping the slider and the A button is held down.

    However the issue i have is that while doing this, i can drag the slider anywhere. I want to be able to drag it just left or right along the slider bar.

    I'm aware of why its happening, as i have my cursor set so that it can anywhere, so when the slider is pinned to cursor, it goes wherever the cursor goes. However, i can't seem to figure out how to just make it move just left or right along the slider bar.

    So i need help with two things:

    1. Get the slider to just move left or right along the slider bar axis when using the gamepad.

    2. Have the cursor in the centre of the slider when dragging it. Right now, when dragging the slider, it moves to the side of the slider (makes more sense if you try the capx). This is a minor issue, it just something i would like to sort out but its not a priority.

    Would appriciate some help and apologies if it seemed like i was going on and on in this post, i just wanted to try and explain the problem as best i could.

    CAPX - https://www.dropbox.com/s/sc10hieacrf2ux1/Slider%20%28Controller%29.capx?dl=0

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fixed this a couple of other issues:

    dropbox.com/s/91b0fifq00wysj7/SliderGamepad.capx

    Edit: I missed the "Have the cursor in the centre" part. You can simply add "Set Cursor position to Slider" in event 13. And you should move the Origin image point in Cursor sprite to its tip.

  • dop2000

    Cheers dude. Honestly lost count of the amount of times i've thanked you lol.

    Really appreciate your help on this, thank you.

  • dop2000

    Really sorry for bothering you again (hopefully it's the last time!) but i have ran into an issue i was hoping you can help with.

    So i have a slide out menu that initially appears off screen but slides in to screen when triggered by pressing a button. I have my slider pinned to that menu so it slides out as well when it's triggered.

    With the examples you've previously provided, i've got the slider set up and working with the touch controls, however i've got an issue with the gamepad controls.

    When i use then gamepad controls the move the cursor, the slider value changes each time when closing & opening the menu. This doesn't happen with the touch controls and the events for touch & gamepad are similar for the most part.

    I have had to make a few adjustments from the example you last gave, i've added pin and unpinning the slider actions due to the sliding out menu - which you can see in the capx.

    I was hoping you could help fix this issue, I'm sure its the way i've set it up but i can't figure out how to fix it.

    https://www.dropbox.com/s/z56ncsfs7jm63im/SliderGamepad%20%28pop-up%29.capx?dl=0

    Again, i do apologise for constantly asking for your help, i really do hope this is the last time.

    Thanks

    Also, i have Litetween plugin used in the capx.

  • tomhaiger

    This is easy, just add "Slder_button isDragging=1" condition to the event #25

    .

    Also, where did you get the WebStorage plugin?! It has been deprecated at least 3 years ago! You need to use Local Storage instead.

    And, you probably know this, but the sprite cursor will not work with Form Controls (your big OK button is a Form Control).

  • dop2000

    Wow, i feel stupid lol. I've been racking my brain trying to workout how to fix this and it turns out to be so simple. Thanks again.

    I only added the big OK button for that capx as a way to navigate between layouts, i don't actually use that in my project.

    With Webstorage, you can still access it by right clicking on insert new object and check show deprciated objects. The reason i'm still using it is because i've used it in past projects to save settings etc and works fine, so i thought i'd just stick with it.

    Thank you again, i can't tell you how grateful i am for your help on this. Hopefully i won't need any more help :)

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