making HUD analog joystick that lines up with gamepad

Get help using Construct 2

Post » Thu Jul 24, 2014 6:43 pm

Hi there,

I'm doing something that uses the analog joysticks for the Ouya at first.

I'm trying to show the joystick moving on the screen.

my main focus is on figuring out how to properly capture / quantize the input for both joysticks on the X and Y..

there is the compare axis, which offers some comparison, but it does't seem to really allow realtime comparison of ranges of value.. since we don't just want simple on / off in this case

there don't seem to be any actions for "every tick" directly tied to the gamepad... now if i go to "compare to values" from the system i can see a few things as seen in this screenshot

Image

I just am not used to working with this kind of data.. I was able to capture -1 and +1 data but it seems to only offer X data.. i couldn't figure out how to get the Y data.. and then how to indicate if the data is from the Left or Right analog stick

I attached the file too

Thanks!
Caleb
You do not have the required permissions to view the files attached to this post.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Thu Jul 24, 2014 8:19 pm

http://part12studios.com/temp/ControllerTest2/ this is a better version but ultimately I can only get this to work if the analog joysticks are simply "on" or "off".

Image

I can see that I can compare any value coming from the joystick, but it seems like it would be terribly tedious to create a bunch of degrees of "between this and that value" incrementally.

just seems like a fluid system could be created, but I can't figure out how I can capture the true X and Y data from each analog joystick to make use of that data.

Attached an updated capx..
You do not have the required permissions to view the files attached to this post.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sat Jul 26, 2014 4:47 am

Ok so I've had some success with the analog joystick stuff, but I'm reaching my edge of understanding what is going on with the gamepad.. but I think we're close to having this pegged.

here is a video of the joystick in motion:
https://dl.dropboxusercontent.com/u/699 ... ue%201.mov

here is a working (kinda) project:
http://part12studios.com/temp/ControllerTest3/

here is where I believe the trouble is at:
Image

so in this picture you will see I'm using this basic formula.. both for X and Y..

Left_Analog_Y_Pos+((Gamepad.Axis(0,0))/2)

and

Left_Analog_X_Pos+((Gamepad.Axis(0,0))/2)


so I'm listening to this gamepad.axis value but it has two values.. 0,0 which I assume is for X,Y

the issue I'm having is I don't know how I would tell Construct to listen to the second value and ignore the first one.. the diagonal motion is basically because when I move either direction I'm adding the same X value to both X and Y which causes the diagonal motion.. if I could listen to that second 0 for the Y events, then everything should be pretty darn peachy.

Thanks!
Caleb
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sat Jul 26, 2014 7:21 am

As far as I can understand it should work like this:

Create a 200 by 200 round sprite (the Base) and a small sprite (the stick)

every tick set the small sprites position : X = base.x+Gamepad.axis(0,0) Y= base.Y+Gamepad.Axis(0,1)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jul 26, 2014 1:08 pm

@littlestain yes that worked! I've never used set position before.. i always did set x and set y (which of course I can now see isn't the best way to do it :)

So there is only one other question I need to figure out as part of this.. this seems to be a non specific axis input.. but Construct 2 supports left and right joysticks.. so I have to figure out how to capture the raw data from both the Left and Right joystick..
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sat Jul 26, 2014 2:18 pm

So this is a little further along. I've mapped out more buttons and the analog (Left and Right) are linked up

http://part12studios.com/temp/ControllerTest4/

because as far as I can tell there is no way to define the Gamepad.axis as left or right analog.

this also raises the question of accessing the analog left and right triggers..

seems there are effectively four unique analog inputs coming from a standard xbox controller so its critical to know how to track these values independently and from the options listed, I don't get a sense of how that would work.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sat Jul 26, 2014 3:05 pm

have you tried gamepad.axis(0,2) and (0,3)?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Jul 26, 2014 4:51 pm

I had tried (1,1) and (1,2) but hadn't tried that and yes your suggestion worked! :) Thanks again!

I didn't know what those values represented.. I thought maybe it was some kind of on / off thing or something.

So any suggestions on how to get the analog value from the left and right triggers? I've done some testing (0,5) ,etc and that didn't seem to work.. I can get them to react ive they are called on, but not sure how to reach the analog value.

Thanks!
Caleb
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sat Jul 26, 2014 6:07 pm

So also here is the project attached in it's current state.. i've switched over to doing a configuration for an xbox controller since that's the official controller.. although i believe this is a madcatz from the original xbox, but seems to have all the same buttons.

I'm also attaching the capx this time.. this is totally setup as it should be except for the analog left and right triggers (up top)

you'll see a blue and green box up top.. these are meant to be the analog triggers.. i figure they could either just move up and down or perhaps grow/shrink with the increasing and decreasing of value.. full height when the player is not pulling on it..

http://part12studios.com/temp/ControllerTest5/

What will be nice is this can act as a template for future folks who might want to do something with a gamepad and be sure its working.

Thanks!
Caleb
You do not have the required permissions to view the files attached to this post.
B
56
S
9
G
1
Posts: 938
Reputation: 6,458

Post » Sat Jul 26, 2014 8:12 pm

Have you tried gamepad.button(0,0) , (0,1) etcetera?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: adamebastin, mekonbekon, plinkie, yippiez and 9 guests