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 / problem with diagonal movement logic or something (with joy)

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th May 2021 15:12 Edited at: 27th May 2021 15:20
i have something like this to set up the joystick detction

Then i have this

The the arrow keys work perfectly for movement
but up and down joystick works if i use left right arrow keys things are fine
left right works if i use up down arrow keys
but i cant get the joystick to work diagonally even tho the spites i have on screen to display movement appear to work correctly sometimes

just cant get to move left or right with the joystick up / down

im sure theres something wrong in the code just why does the keyboard work perfectly is there a refresh state or something i should do

Thanks in advace

PS:I have placeholders in place for multiplayer but cant add that until i get the joystick to read properly
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 27th May 2021 17:04 Edited at: 27th May 2021 17:16
At a glance, is your joystick set to digital or analog? If digital, anything under 0.5 will cast as 0 since ur using integer variables while raw joystick commands return floats for x/y.

NMD... that's not it ("//.5")
[My Itch.io Home] [Community Apps on Itch.io]
[AGK Resource Directory] [TGC @ GitHub]
[CODE lang=agk] YOUR CODE HERE [/CODE]
[VIDEO=youtube] VIDEO ID [/VIDEO]
[AGK Showcase][Google Forum Search]
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 27th May 2021 22:01 Edited at: 27th May 2021 22:01
Thanks VN
Even if i replace either up/down joy or left/right joy for buttons i still get the same issues
it was my logic

the problen was GetDirectionSpeed() needed to be replaced with GetRawJoystickX( player[0].joyID)
fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk

Login to post a reply

Server time is: 2024-11-23 12:29:03
Your offset time is: 2024-11-23 12:29:03