Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Best method for Joystick like Mouse ? [AGK1]

Author
Message
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 24th Mar 2016 14:43
Hi, all,

I am looking for suggestions on how to approach using a joystick like a mouse.
(joystick moves a pointer around the screen to select things)

I've tried a method where the 'harder' you push the joystick in a direction, the faster the cursor moves.
I've also found some strange behavior on the diagonals (less response in both directions)

So what have you tried? And better yet , what *works* ?

Thanks,
Bob
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Mar 2016 15:05
The last joystick I had used the MIDI interface!
Maybe I should buy one and have a play.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Mar 2016 16:56
You could do something like...

This WILL NOT work on touch enabled devices, as you can't move the pointer location. (Without touching the screen)

You can however, create your own mouse pointer variables, and use the above to set it's positions via the joystick/pad, and refer to those, rather than AGK's pointer/mouse commands.
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 24th Mar 2016 17:11
hmmm... that is actually quite interesting,
although "position the actual mouse pointer" was not what I had in mind.

i'm just looking for a proper implementation of using a gamepad/joystick on a PC to move a "cursor"...

interesting though, I will mess with that
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 24th Mar 2016 21:12 Edited at: 24th Mar 2016 21:22
The real problem is making the cursor move fast enough when the player wants it to go clear across the screen , vs. allowing fine control.

Using (and modifying) something mobiius suggestion, I've done this:


basically, if you are not pushing very hard on the stick, it uses a smaller multiplier to movement ("magnitude").

It works fairly well, but could probably be refined over time... and it's annoyingly hard to close...
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Mar 2016 08:44
If you take the joystick value (0 - 1.0) and convert it to a value between 90 and 180 (90 + (90 * joyStickVal)) you can then use SIN to make the joystick value respond better.
i.e make the range in the bottom end of the movement more accurate, and at the top end it will start to react slower to movement as the speed increases.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 2nd Apr 2016 13:45
Stardew Valley (great new indigame) does straight joystick angle to movement speed. The more you tilt the faster the cursor moves. It's works great for that game, but you don't need to use it often when playing with a controller so I don't know if it's optimal for your game.
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 10th Apr 2016 19:50
BatVink,
that seems interesting, but also a little confusing to me.
I will play around with it.

regarding "stardew valley", I watched the release of that one. I swear they must have been paying to review the game, it had >1000 steam reviews in its first HOUR.

thanks everyone.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 10th Apr 2016 20:50
Here is some code to explain it. It prints the joystick input 0 - 1 and Joystick Output, also 0 - 1
BUT the output has been converted so that initial movements are finer than faster movements the other extreme

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 12th Apr 2016 19:14 Edited at: 12th Apr 2016 19:15
Quote: "regarding "stardew valley", I watched the release of that one. I swear they must have been paying to review the game, it had >1000 steam reviews in its first HOUR."


Talked to a friend who had already played during early access. So that game was popular even before it released. And when it did, every one put in a review. It's a really good game too. Played it a ton when I bought it, was sick and home from work too so had plenty of time.
IBOL
Retired Moderator
20
Years of Service
User Offline
Joined: 30th Mar 2004
Location: @IBOL17
Posted: 21st Apr 2016 22:18
@BatVink:
great idea, with the SIN() . I tried it, but whether I pushed right or left, it all went the same way. (number was always positive).
so here is how I implemented it. it is much sloppier than yours, but it is my first experiment with it, and it works.

Login to post a reply

Server time is: 2024-09-29 13:28:05
Your offset time is: 2024-09-29 13:28:05