The Daily Click ::. Forums ::. Klik Coding Help ::. Xbox 360 Trigger/ D-Pad Help
 

Post Reply  Post Oekaki 
 

Posted By Message

Sumo148

Super amazing fantastic user

Registered
  26/01/2009
Points
  530

360 OwnerThe Cake is a LieVIP MemberPokemon Ball!I am an April FoolI donated an open source projectSanta Hat
31st January, 2010 at 18:21:54 -

Hey I'm working on xbox 360 controller support and I need some help. I'm using the joypad 2 object by z33z. I have all the button "value numbers" that you need to use in the action editor. This is what I have...

A= 1
B= 2
X= 3
Y= 4
Left Bumper= 5
Right Bumper= 6
Back= 7
Start= 8
Left Analogue Click= 9
Right Analogue Click= 10

Left Trigger= ?
Right Triger= ?
D-Pad (left, right, up, down)= ?


How would you access the triggers and the d-pad on the controller? Those are the only buttons/triggers that I need to know?

 
n/a

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
1st February, 2010 at 21:08:41 -

Hey Sumo,

The triggers and the D-Pad are a little confusing (which is no fault of z33z). If you open up the Game Controllers applet in Control Panel, you'll see your Xbox 360 controller listed. Open the properties for the controller and click on the Test tab. What you'll notice is that the Triggers correspond to the Z-axis (and not a specific button). The D-pad corresponds to the Point of View Hat.

The extension that z33z developed can access both of these so you should be able to program for them. Now, I'm not really a great coder but I've run into two issues:
1. I can have the extension check for 4 different directions on the D-pad (forward, backward, left and right). However, I can't have it check the other four directions (forward+right, forward+left, backward+right, backward+left). If you can figure this out, let me know.

2. I can check the D-pad or the triggers to see if they are currently pressed but can't seem to check if they've JUST been pressed. Which means that I can do the event equivelant of "Repeat while button XXX pressed" but can't seem to do the event equivelant of "Button XXX pressed". Does that make sense? Probably not.

Anyway, I'm a fan of open source and examples. Here is a BAD example that I created a while back. Warning: It's old. It's incomplete. It's ugly.

http://toadstool.net/games/misc/Joystick2_Test_WIP.mfa

But, you might get something from it. Let me know if you work out either of these two issues.

 

Sumo148

Super amazing fantastic user

Registered
  26/01/2009
Points
  530

360 OwnerThe Cake is a LieVIP MemberPokemon Ball!I am an April FoolI donated an open source projectSanta Hat
1st February, 2010 at 21:26:13 -

Thanks Jess! Oh and I found out how to do all of the D-Pad directions that are "in between". You just have to use "Compare two general values"

For the first edit box do POVDegrees( "Joystick 2 object", 1) (this test the degree of the D-Pad)
For the second edit box, add the degree you want to test it with.

Up= 90
Down= 270
Left= 180
Right= 0
Up+Left= 45
Up+Right= 135
Down+Left= 225
Down+Right= 315

There you go! And for the trigger problem, you may be able to add "only one action when even loops".

Edited by Sumo148

 
n/a

Jess Bowers

Cake > Pie

Registered
  09/01/2009
Points
  310

Has Donated, Thank You!GOTM FEB - 2010 - WINNER!GOTW Winner!
1st February, 2010 at 21:49:37 -

Great work, Sumo! I was wondering what felt "more natural" for a side scrolling shooter... the D-pad or the Thumbstick. So far, I've only used the thumbstick since I couldn't get the D-pad working properly.

 
   

Post Reply



 



Advertisement

Worth A Click