Joystick for moving a sprite

Get help using Construct 2

Post » Sat Jan 07, 2017 11:26 pm

I was reading about different kinds of joysticks in Construct 2. In the game I'm making the joystick moves the character in 8 different directions. The joystick doesn't need another circle inside of it. I looked at different tutorials but am not sure which one would work best. it has to be continuous movement. Like a person can keep moving the character, so it has to go from direction to direction without going back to the middle before the player can move it again.

It's a fixed joystick. There is no jumping, it's just moving a sprite around. I know some joysticks move, others have circles inside of them that move. this doesn't need any of that. as long as they can touch it and move the sprite in 8 directions, it works.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Sun Jan 08, 2017 9:24 am

Imo having even a small circle inside a larger one helps the user visually. Someone helped me with this before, having a small circle inside a larger one. And it was constant and fluid.

The smaller circle did not need to recenter to move again.

I'll see if i still have that capx later today. In the meantime, do a forum search for 'thumbstick' and browse through the posts.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Sun Jan 08, 2017 10:58 am

@Phoenixbowman

This is one of my thumbsticks, and the easiest to follow:

Image

Image

Again, it seems like a lot, but it does move pretty fluidly. And if you'd like, you can set the thumbstick (the small inner circle) at 0% opacity so it won't be seen.

There is a way to do this just with a touch input and without a thumbstick, but imo users tend to slide their thumb around the screen, which makes them have to stop, lift their thumb and bring it back down to the corner. This way it gives them a point of reference for their thumb.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Tue Jan 10, 2017 4:45 pm

Oh wow thank you, thank you so much. Is it possible to take out the angle so the Sprite doesn't rotate?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Jan 10, 2017 5:00 pm

So you don't want the sprite to turn at all?
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Tue Jan 10, 2017 5:06 pm

The sprite is a person, so no, can't be turning at all, has to be upright. Would I just remove the angle part of the code? Say the Sprite's angle is 180 degrees, that has to stay the same and can't change, sorry.

Imagine a person walking at a constant speed. Going from 0 and when the player moves the joystick, the sprite goes from 0 to max speed instantly, and when they release the joystick, the sprite stops, no slowing down.
Last edited by Phoenixbowman on Tue Jan 10, 2017 5:13 pm, edited 1 time in total.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Jan 10, 2017 5:11 pm

Its been a while since i messed with that, but i think you would remove the action rotate 225....
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Fri Jan 13, 2017 10:23 pm

Sorry, what's a Local Static Variable? I was looking over the code and I noticed something called local static variable.

Is a joystick a good idea for a sprite that can't rotate? like the sprite's orientation is 0 degrees, and can't rotate. Imagine a person standing upright and moving at a constant speed in 8 directions depending on where the joystick is being moved.

Like no acceleration, move joystick, go from 0 to x speed, release joystick, stop. Or would arrow keys work better?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Fri Jan 13, 2017 11:33 pm

It's basically a person running around. So there is no acceleration, it's one speed and the sprite can move 8 different directions. Like move at one speed in one of 8 directions. Like the sprite is standing still. When the sprite starts moving, it moves at one constant speed, no accelerating or decelerating.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Mon Jan 16, 2017 6:17 pm

Sorry I'm still not sure how to do this. The Sprite has one speed and can move in 8 different directions. Moving the joystick will make the sprite move in one of 8 directions at a constant speed, no acceleration or deceleration.

I see the code but don't know what a Local Variable is.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 1 guest