Joystick X and Y questions [SOLVED]

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

18 Likes

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

4 Likes

Cool topic!

6 Likes

Ah good you added the tag.

2 Likes

Lgbot please

3 Likes

Maybe publish a wip, so people can see it?

4 Likes

I thought there was a in app tutorial for that

3 Likes

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

3 Likes

With the player centered.

2 Likes

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

2 Likes

Yea just make the other objects move Instead of the character

2 Likes

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:

4 Likes

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
5 Likes

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

1 Like

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

3 Likes

What fish game???

2 Likes

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

2 Likes

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

3 Likes

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

1 Like

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

2 Likes