Joystick X and Y questions

help_me_please

#1

So I’m making a game with a joystick, with the player always centered. And I want the X and Y to change when the joystick is moved. However I don’t understand how it works.
@pomtl


#2

Agreed. This has always confuddeled me as well, so help please.


#3

Cool topic!


#4

Ah good you added the tag.


#6

Lgbot please


#7

Maybe publish a wip, so people can see it?


#8

I thought there was a in app tutorial for that


#9

For the joystick yes, but not for moving biased on the joystick.


#10

With the player centered.


#11

Like X and Y like when my character is moved (character is always centered) the variable X and Y are changed


#12

Yea just make the other objects move Instead of the character


#13

So I don’t know specifically how to do it, but if the character stays centered in the middle of the screen, then you have to make everything in the world move in the opposite direction of the way the character is “moving”.

@Funky_63_Greenland did projects like this sometimes. Here is one such project that you can look at the code of:


#14

How you approach this will depend on if you want to also incorporate collision checking.

Here’s a sample project I coded recently that incorporates collision checking:


If all you want is everything to move, it’s pretty simple

  • X/Y moment values are reset to 0
  • The keypad/joystick sets the values for the X and/or Y movement (in the opposite direction as t7lks said)
  • The “world objects” Set Position to their current position plus the X/Y movement (put this in a custom rule of When [‘X movement’ < > 0 OR ‘Y movement’ < > 0 ] and add it to all objects that should move

#15

Ok I know how to do this! TDO ask me if you have any doubt! (But plz be specific!!! Plzplzplzplz)


#16

Like Bumpsplats HoverTanx kinda movement. Yeah or ur fish game thingy. I’m still confused…


#17

What fish game???


#18

I got a code to generate a joystick if you want I can pass it to u


#19

I mean like the game where u eat the fish and get bigger? U made it


#20

Nope… I nominated it for featured, but I made this game (lemme post it)


#21

Here @TheDeliciousOrange
https://c.gethopscotch.com/p/1041612cqc
U know how to open this kind of WIPs right?