Jump to content


Photo

Xin - Xbox 360 Controller Support


  • Please log in to reply
70 replies to this topic

#1 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 13 July 2012 - 01:33 PM

Xin v1.1
By JacksonYarr


Not completely content with GameMaker's current selection of XInput DLLs and extensions, I decided to create my own. Although originally intended for my own project, I'm sure there are others out there who will find this of use.

Features Include
  • Full Xbox 360 Controller Support within GameMaker.
  • Button Check Pressed and Released Functions
  • Compensation for Thumbstick & Trigger Deadzones
  • Support for 4 Controllers, All Buttons & Force Feedback (Rumbling).
v1.1 Updates
  • Fixed deadzone issue with thumbsticks causing limited range (0.25 - 1). Range is now correctly (0 - 1).
  • The functions xin_check(), xin_check_pressed(), and xin_check_released() now work with the left and right triggers.
Download
Host-A Hosting (0.15 MB)
(The download includes the extension, a help file, a GM8.1 example and a GM:Studio example.)

License
CC0 1.0 Universal (CC0 1.0) - Public Domain Dedication
(You can copy, modify and distribute the work, even for commercial purposes, all without asking permission.)

Additional Notes
  • Let me know if you run into any problems or bugs when using the extension, suggestions for improvement are also welcome.
  • Although attribution (credit) is not required, it's always greatly appreciated.
  • In certain circumstances the built in thumbstick deadzones may prove to be a hindrance. Xin NDZ Version removes these built in thumbstick deadzones. (Do NOT use this version unless you fully understand the function of, and implications of removing these deadzones.)
  • If you've never tried PC gaming with an Xbox controller I can highly recommend it.

Edited by JacksonYarr, 31 January 2013 - 07:36 AM.

  • 7

#2 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 14 July 2012 - 09:46 PM

Oh boy, oh boy! Just what I was looking for. Just yesterday I made a post in the Sinazxinput thread, which doesn't seem to be supported anymore. Just like you, I wasn't happy with the controller support in game maker. This comes at just the right time. Will check this out tomorrow, thank you very much.

Edit: Actually tried it out right now. Says "Controller 1/2/3/4 not connected". I'm using a wireless Xbox 360 controller, which works fine with the built in joystick functions of game maker. Any idea what the problem is?

Edited by RuinaImperi, 14 July 2012 - 09:56 PM.

  • 0

#3 Southman

Southman

    I simply am not here

  • GMC Member
  • 1662 posts
  • Version:GM:Studio

Posted 14 July 2012 - 10:10 PM

Yes! I was using SinazXInput, but the deadzones bugged me, so I hope this will be better. Can't test it now, but I will comment once I get the chance.
  • 0

#4 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 15 July 2012 - 02:32 AM

Actually tried it out right now. Says "Controller 1/2/3/4 not connected". I'm using a wireless Xbox 360 controller, which works fine with the built in joystick functions of game maker. Any idea what the problem is?


Unfortunately I don't have a wireless controller handy, so I can't do any testing to say for sure. Once the example has loaded though, does pressing the Guide button (The Xbox logo button) or the Start button result in a connection?

If not, do you have all the Xbox 360 Wireless Drivers installed?

My only real thought as to the cause is that your computer might be registering it as a joystick, but not an Xbox controller specifically. I might invest in a wireless receiver shortly, so if all else fails let me know and I'll see if I can replicate the issue.
  • 1

#5 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 15 July 2012 - 10:02 AM

Yes, I do have all the drivers installed and it is recognized by Windows. It works just fine in all games too, including Games For Windows Live games that use the guide button. I don't get a connection when pressing the Guide button or the start button either.

Would be great if you could get a wireless receiver to see for yourself.

Edited by RuinaImperi, 15 July 2012 - 10:03 AM.

  • 0

#6 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 15 July 2012 - 11:03 AM

Any chance you could download and run this quick debug program I've written? It should report a number for each controller, hopefully these numbers will give me a little more insight into the problem.

I've ordered a wireless receiver, so hopefully I'll be able to do some testing myself shortly.

If anybody else is having trouble with Xin and wireless controllers - or if your wireless controller is working fine with Xin, it'd be great if you could let me know.
  • 1

#7 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 15 July 2012 - 12:48 PM

I'd like to, but that debug program gives me the following error:
"The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail."

Edited by RuinaImperi, 15 July 2012 - 12:49 PM.

  • 0

#8 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 15 July 2012 - 02:52 PM

I believe I've managed to track down and resolve the issue. I've updated the download link to the newest version of Xin.

I'd strongly recommend that anyone who has already downloaded Xin to delete their copy, and re-download the newest version to ensure maximum compatibility amongst users.
  • 1

#9 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 15 July 2012 - 03:04 PM

It does work now! Thanks a lot. Going to look into how to actually implement and report back.


Edit: Got it up and running in my game now, got some problem where the rumbling is way too weak if it is anything under 1, while in your example 0.30 is plenty. Having it at 0.30 in my project it's barely there. That's possibly something I did wrong though, so I'm going to look into that some more tomorrow.

Edit2: Nevermind, works great. It was as you said, switched it on and off repeatedly.

Edited by RuinaImperi, 18 July 2012 - 03:19 PM.

  • 0

#10 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 16 July 2012 - 02:51 AM

Got it up and running in my game now, got some problem where the rumbling is way too weak if it is anything under 1, while in your example 0.30 is plenty. Having it at 0.30 in my project it's barely there. That's possibly something I did wrong though, so I'm going to look into that some more tomorrow.


Glad it's working now. Double check you're not constantly resetting the motor speeds to 0 at some point in your code. Doing so causes the motors to rapidly alternate on and off, resulting in a weak vibration.
  • 1

#11 FiLkAtA

FiLkAtA

    GMC Member

  • GMC Member
  • 541 posts
  • Version:GM:Studio

Posted 03 August 2012 - 08:26 PM

I've run into some strange problems with this extension. I am usign Studio and when I open the example everything runs fine, but when I try using it in my game just calling xin_update(0) makes Studio stop working. Any ideas?


EDIT: I tried it in a empty file, one room, one object, one line of code and it still crashed, so I know it is not my game, yet the example runs perfectly. Am I missing something obviuos?


EDIT2: Some more light on the problem - I found out that if I reimport the gex in the example with the seperate gex file in the download it stops working too. But exporting the original gex from the example and using that in my game doesn't work - still crashes.


EDIT: I found the solution, should be helpful for anyone that might encounter the same problem - opened the extension from the example in the explorer and copied it to the appropriate folder in my project, ovewritting the existing files. It works!


Edited by FiLkAtA, 03 August 2012 - 09:41 PM.

  • 0

#12 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 04 August 2012 - 08:12 AM

Glad you managed to get it working.

I had a double check of the release zip, and the GEX file included seems to be working fine. My only thought is that maybe something corrupted your download. You could try re-downloading Xin to see if this was the problem.

Let me know if you run into any further issues.

Edited by JacksonYarr, 04 August 2012 - 08:13 AM.

  • 1

#13 dasrkrain

dasrkrain

    GMC Member

  • GMC Member
  • 204 posts
  • Version:GM:Studio

Posted 28 September 2012 - 04:11 AM

Thanks guys! FiLkAtA - same thing happened to me! Thanks for the solution!
  • 0

#14 8bitsdeep

8bitsdeep

    GMC Member

  • New Member
  • 8 posts
  • Version:GM:Studio

Posted 31 October 2012 - 01:06 PM

Very nice extension! Works like a charm, thanks for making it.

Any chance you could add a the left and right Triggers to the check_pressed and check_released functions? It's the only think keeping this from being perfect.
  • 0

#15 FiLkAtA

FiLkAtA

    GMC Member

  • GMC Member
  • 541 posts
  • Version:GM:Studio

Posted 08 November 2012 - 10:10 PM

I am having some strange problems with this extension again. Everything is working fine with my controller but when I send the game to a friend of mine (doesnt matter source or exe) he cant get it to work, tried different controllers on different computers. Any ideas?
  • 0

#16 Dreedo

Dreedo

    GMC Member

  • GMC Member
  • 1308 posts

Posted 22 November 2012 - 01:43 PM

Hi,

Does anyone know how to get this working in Wine, if it's even possible?

My computer detects the 360 controller, but it can't use XinDLL.dll.
  • 0

#17 Criminon

Criminon

    Final Element

  • GMC Member
  • 193 posts
  • Version:GM:Studio

Posted 03 December 2012 - 04:04 AM

Does this work for 8.0 pro? It doesn't seem to work, but I'm not sure. The gex loaded in okay, however.

It could be the way I'm entering the information. I don't really understand the xin_update(index); command.

if (xin_check_released(1,xb_down)){
do code
}

is this correct? I'm sorry, I can't view the example files due to them being 8.1
  • 0

#18 samusetroid

samusetroid

    GMC Member

  • GMC Member
  • 127 posts
  • Version:GM:Studio

Posted 30 December 2012 - 05:56 AM

Does Game Maker's built in joystick gml work with wireless controllers too?
  • 0
-Joel Carretero

#19 le-mec

le-mec

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 14 January 2013 - 08:11 AM

Additional Notes

  • Let me know if you run into any problems or bugs when using the extension, suggestions for improvement are also welcome.


Works great but there's a huge deadzone on thumbstick axes, like 25%.

It's a real problem when making dualstick shooters since the deadzones are applied per-axis. This means that when a thumbstick is pushed to the edge limit, there's a snapping effect that occurs as the stick nears a horizontal or vertical orientation.

Would be nice to specify or completely disable deadzoning and handle it manually in the game's code.

Edited by le-mec, 14 January 2013 - 08:12 AM.

  • 0

#20 Chrscool8

Chrscool8

    Call me Chris.

  • GMC Member
  • 2399 posts
  • Version:GM:Studio

Posted 15 January 2013 - 04:51 AM

Weird. It works fine in the example Studio file, but when I try adding "xin_update(anything)" it immediately crashes. I cant tell what I did wrong here. Even when copying the code exactly, once it hits that line, it dies.

EDIT:
Anyways, it works now... I'm not sure what's changed but, nevermind, and great work, then!

Edited by chrscool8, 15 January 2013 - 06:46 AM.

  • 0

Click the banner to check out my game, Suh Burb!

XPTintI.gif

Add me on Steam! Let's talk about making games!


#21 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 15 January 2013 - 12:10 PM

I've used this for a while now and it's really great. It's a shame YoYoGames hasn't integrated proper Xbox 360 pad support into Studio by now since especially with Steam Big Picture and Steambox on the horizon proper controller support is a big plus, and the Xbox 360 pad is by far the most widely and commonly support PC gamepad.

I hope they get to it eventually, but until then we have this great help. I just hope it stays compatible. Anyway, thanks again for this magnificent piece of work!
  • 0

#22 Chris M

Chris M

    GMC Member

  • GMC Member
  • 15 posts
  • Version:GM:Studio

Posted 22 January 2013 - 04:30 AM

Works great for me, thanks! :D
  • 0

#23 Tyrant117

Tyrant117

    GMC Member

  • New Member
  • 11 posts
  • Version:GM:Studio

Posted 23 January 2013 - 05:36 AM

Top notch, works flawlessly.
  • 0

#24 le-mec

le-mec

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 24 January 2013 - 04:33 AM

It works, for the most part, but the deadzones on the thumbsticks is rather problematic.
  • 0

#25 JacksonYarr

JacksonYarr

    GMC Member

  • GMC Member
  • 248 posts
  • Version:GM:Studio

Posted 31 January 2013 - 07:34 AM

Version 1.1 released!

I've made a few small improvements to version 1.1 of Xin, which you can download from the original post. An issue with the thumbstick range has been fixed, and you can now use the check/pressed/released functions on the left and right trigger.

Additionally I've uploaded Xin v1.1 NDZ which features these improvements and also removes the built in thumbstick deadzones (See the additional notes in the original post to download). Which in certain circumstances can prove to be a hindrance. Please only use this version if you understand the implications of having removed these deadzones though.

Additionally, thank you for all the feedback. It's very much appreciated.
  • 2

#26 le-mec

le-mec

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 31 January 2013 - 07:49 AM

Version 1.1 released!

I've made a few small improvements to version 1.1 of Xin, which you can download from the original post. An issue with the thumbstick range has been fixed, and you can now use the check/pressed/released functions on the left and right trigger.

Additionally I've uploaded Xin v1.1 NDZ which features these improvements and also removes the built in thumbstick deadzones (See the additional notes in the original post to download). Which in certain circumstances can prove to be a hindrance. Please only use this version if you understand the implications of having removed these deadzones though.

Additionally, thank you for all the feedback. It's very much appreciated.


DUDE. DUUUUUDE. I LOVE YOU. I'm gonna try it out RIGHT NAO. Thank you for working to fix Xin!

EDIT: The NDZ version is confirmed - NO DEADZONE! :D

Also, I made a version of the GEX that includes constants for the following button bitflags to be used with xin_get_input_bitmask

#define XINPUT_GAMEPAD_DPAD_UP          $0001
#define XINPUT_GAMEPAD_DPAD_DOWN        $0002
#define XINPUT_GAMEPAD_DPAD_LEFT        $0004
#define XINPUT_GAMEPAD_DPAD_RIGHT       $0008
#define XINPUT_GAMEPAD_START            $0010
#define XINPUT_GAMEPAD_BACK             $0020
#define XINPUT_GAMEPAD_LEFT_THUMB       $0040
#define XINPUT_GAMEPAD_RIGHT_THUMB      $0080
#define XINPUT_GAMEPAD_LEFT_SHOULDER    $0100
#define XINPUT_GAMEPAD_RIGHT_SHOULDER   $0200
#define XINPUT_GAMEPAD_A                $1000
#define XINPUT_GAMEPAD_B                $2000
#define XINPUT_GAMEPAD_X                $4000
#define XINPUT_GAMEPAD_Y                $8000

https://host-a.net/u...n.extension.gmx

EDIT:

Look! It works beautifully!!!!! (YouTube)

Edited by le-mec, 01 February 2013 - 12:57 AM.

  • 0

#27 Dataflashsabot

Dataflashsabot

    GMC Member

  • GMC Member
  • 28 posts

Posted 31 January 2013 - 12:43 PM

Hey JacksonYarr, glad to see you implemented the features I mentioned in PM! I'd still like to add support for the Guide button, though, if you'd be interested? If you'd like to do it yourself, manually load xinput1_3.dll from the system directory and use GetProcAddress to load a function from ordinal 100 matching this signature:

int(__stdcall *secret_get_gamepad) (int, XINPUT_GAMEPAD_SECRET*);
The int is the controller index.
The struct it outputs to (I called it XINPUT_GAMEPAD_SECRET) is very similar to but different from XINPUT_GAMEPAD and looks like this:

unsigned long eventCount;
WORD                                wButtons;
BYTE                                bLeftTrigger;
BYTE                                bRightTrigger;
SHORT                               sThumbLX;
SHORT                               sThumbLY;
SHORT                               sThumbRX;
SHORT                               sThumbRY;

It returns 0 on success or 1167 on failure.
Then bitiwse AND wButtons against 0x00400 to see if the guide button is down.
  • 1

#28 TehWave

TehWave

    GMC Member

  • GMC Member
  • 42 posts
  • Version:GM:Studio

Posted 04 February 2013 - 08:43 PM

I require help, if you would please.

This is my code:

d=point_direction(x,y,mouse_x,mouse_y)

d is currently the direction from my mouse, but want it to be able to get it from the right thumb stick.

How would I accomplish this?

Thanks in advance.
  • 0

#29 le-mec

le-mec

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 05 February 2013 - 06:38 AM

d=point_direction(0,0,xin_get_state(0, xb_rightThumbX),xin_get_state(0, xb_rightThumbY));

  • 1

#30 TehWave

TehWave

    GMC Member

  • GMC Member
  • 42 posts
  • Version:GM:Studio

Posted 05 February 2013 - 11:29 AM

d=point_direction(0,0,xin_get_state(0, xb_rightThumbX),xin_get_state(0, xb_rightThumbY));


Thanks, that worked perfectly!
  • 0

#31 Cooliew101

Cooliew101

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 17 February 2013 - 12:14 AM

For some reason whenever i use xin_check(0,xb_leftThumbY) (or any other thumbstick direction) it returns -1 no matter whether im moving it or not, what is going wrong?

EDIT: BTW, I'm using a wireless controller with a wireless receiver, it works perfectly for other games and I have installed all the necessary drivers

Edited by Cooliew101, 17 February 2013 - 12:22 AM.

  • 0

Cooliew
Game Developer and Web Developer
http://miniarcadegames.net/


#32 le-mec

le-mec

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 17 February 2013 - 07:47 PM

For some reason whenever i use xin_check(0,xb_leftThumbY) (or any other thumbstick direction) it returns -1 no matter whether im moving it or not, what is going wrong?

EDIT: BTW, I'm using a wireless controller with a wireless receiver, it works perfectly for other games and I have installed all the necessary drivers


xin_update(index);

Updates the state of the specified controller (0 - 3 or all). This needs to be called before new input can be received from the controller. Returns true or false. 


  • 0

#33 Cooliew101

Cooliew101

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 18 February 2013 - 04:06 AM

For some reason whenever i use xin_check(0,xb_leftThumbY) (or any other thumbstick direction) it returns -1 no matter whether im moving it or not, what is going wrong?

EDIT: BTW, I'm using a wireless controller with a wireless receiver, it works perfectly for other games and I have installed all the necessary drivers


xin_update(index);

Updates the state of the specified controller (0 - 3 or all). This needs to be called before new input can be received from the controller. Returns true or false. 


I was using that for the first line of every script that i was using Xinput commands, I'm not stupid
  • 0

Cooliew
Game Developer and Web Developer
http://miniarcadegames.net/


#34 le-mec

le-mec

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 18 February 2013 - 11:33 PM

For some reason whenever i use xin_check(0,xb_leftThumbY) (or any other thumbstick direction) it returns -1 no matter whether im moving it or not, what is going wrong?

EDIT: BTW, I'm using a wireless controller with a wireless receiver, it works perfectly for other games and I have installed all the necessary drivers


xin_update(index);

Updates the state of the specified controller (0 - 3 or all). This needs to be called before new input can be received from the controller. Returns true or false. 


I was using that for the first line of every script that i was using Xinput commands, I'm not stupid


Wasn't trying to insult your intelligence - but not using that command on each tic is the only reason I can think of for your thumbstick problems.

Did you try accessing the built in Windows joystick control panel to see if the xbox controller and its inputs show up at all?

Windows 7+ obfuscates the joystick control panel, but you can still access it via the following command line (which can be made into a shortcut).

"C:\Windows\system32\rundll32.exe" Shell32.dll,Control_RunDLL C:\Windows\system32\joy.cpl

  • 0

#35 Cooliew101

Cooliew101

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 20 February 2013 - 07:48 AM

For some reason whenever i use xin_check(0,xb_leftThumbY) (or any other thumbstick direction) it returns -1 no matter whether im moving it or not, what is going wrong?

EDIT: BTW, I'm using a wireless controller with a wireless receiver, it works perfectly for other games and I have installed all the necessary drivers


xin_update(index);

Updates the state of the specified controller (0 - 3 or all). This needs to be called before new input can be received from the controller. Returns true or false. 


I was using that for the first line of every script that i was using Xinput commands, I'm not stupid


Wasn't trying to insult your intelligence - but not using that command on each tic is the only reason I can think of for your thumbstick problems.

Did you try accessing the built in Windows joystick control panel to see if the xbox controller and its inputs show up at all?

Windows 7+ obfuscates the joystick control panel, but you can still access it via the following command line (which can be made into a shortcut).

"C:\Windows\system32\rundll32.exe" Shell32.dll,Control_RunDLL C:\Windows\system32\joy.cpl


Sorry for being a bit rude earlier,

I found that using:
if(xin_update(0)) {[insert code here]}
in my step event worked
  • 0

Cooliew
Game Developer and Web Developer
http://miniarcadegames.net/


#36 Spasmer

Spasmer

    GMC Member

  • GMC Member
  • 4 posts

Posted 24 February 2013 - 03:10 PM

It seems like it could be really good. But I get a problem when I use the xin_update(0) the game crashes. I'm using a wireless xbox controller and Game maker: Studio. Any idea how to fix it?
I read the thread and some people had the same problem but managed to fix it, I've tried their methods but it didn't work for me.

Edited by Spasmer, 24 February 2013 - 03:11 PM.

  • 0

#37 stampede247

stampede247

    GMC Member

  • New Member
  • 1 posts
  • Version:GM:Studio

Posted 28 February 2013 - 04:13 PM

It seems like it could be really good. But I get a problem when I use the xin_update(0) the game crashes. I'm using a wireless xbox controller and Game maker: Studio. Any idea how to fix it?
I read the thread and some people had the same problem but managed to fix it, I've tried their methods but it didn't work for me.


I have the same problem spasmer. I'm using Game Maker: Studio v1.1.827

[FIX] You know what I fixed it. I simply hadn't tried it with a if statement around it yet. If you put it in an if statement then it works just fine.

Ex:
if (xin_update(0))
{
//Do stuff
}

Edited by stampede247, 28 February 2013 - 04:33 PM.

  • 0

#38 Kstru

Kstru

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8

Posted 10 April 2013 - 01:33 AM

Guys, I'm creating a space shooter (somewhat similar to geometry wars) and I really need controller input (because the ship shoots in 8 directions). This extension seems pretty awesome, but I'm new at gamemaker and I really need help making the ship move according to the left analog on the controller. Can anyone help with that? Or does someone have an example with analog movement?


  • 0

#39 dasrkrain

dasrkrain

    GMC Member

  • GMC Member
  • 204 posts
  • Version:GM:Studio

Posted 10 April 2013 - 02:45 AM

This will only work with the first controller you plug in to your pc. I don't know any specifics about your game so my instructions will be very generic. That being said let's get started:

 

1. Download this example from the first post in this forum and extract it to the same folder you have saved your game to. 

 

2. With your game open in gamemaker go to: Resources > Select Extension Packages.

     - Click Install button at the bottom.

     - Now click the install button in the new window.

     - Navigate to the folder you extracted the example to and choose Xin_v1.1_Extension.gex

     - Press Ok button

     - Highlight XIN v1.1 and hit the blue <--- arrow then press Ok button.

 

3. Add this to the create event of your ship:

 

//Your ship's speed
mySpeed = 10;

//thumbstick x and y locations
leftThumbX = 0;
leftThumbY = 0;

 

4. Copy this into the step event of your ship:

 

//(x,y) Position of the Left Thumbstick (Returns a value between -1 and 1)
if (xin_update(0))
{
    leftThumbX = xin_get_state(0, xb_leftThumbX);
    leftThumbY = xin_get_state(0, xb_leftThumbY);
}

//Update ship's x and y
x += leftThumbX * mySpeed;
y += leftThumbY * mySpeed;

 

4. Come back here and ask for more help if this doesn't work out right for you.

 

Don't be afraid to play around with it. Also try messing with image_angle stuff to make it look really cool! Other than that this is really basic and generic so don't be afraid to experiment with the code or ask more questions.


  • 1

#40 kidkoexist

kidkoexist

    GMC Member

  • New Member
  • 1 posts
  • Version:GM:Studio

Posted 09 May 2013 - 03:30 AM

Hello, I wonder if someone could help with a little problem I'm having.
 
I'm new to GM and code so please forgive me if this is a little basic.
 
I'm trying to use the start button for pause and unpause. I didn't have any problem getting movement and shooting working with xin, but this is giving me grief.
 
In my step event, I start by checking for the start button press and assigning the result to a variable:
index = 0;
if(xin_update(index)) 
    {
         startButtonPressed[index] = xin_check_pressed(index,xb_start);
    } 
 
 
Then later in the same step event I'm checking if that variable is equal to 1 to pause the game. From the help file, I gathered that xin_check_pressed would return "true" (which is 1, right?)
       if (startButtonPressed[index] == 1)
            {
                //pause game stuff
            }
 
I also have it set to pause if the "P" key on my keyboard is pressed, and that works, so I konw the pause menu is working.
 
Any help would be super appreciated :) [edit: simplified code, still no worky]

Edited by kidkoexist, 09 May 2013 - 04:18 AM.

  • 0

#41 Chrscool8

Chrscool8

    Call me Chris.

  • GMC Member
  • 2399 posts
  • Version:GM:Studio

Posted 09 May 2013 - 11:58 AM

Hello, I wonder if someone could help with a little problem I'm having.
 
I'm new to GM and code so please forgive me if this is a little basic.
 
I'm trying to use the start button for pause and unpause. I didn't have any problem getting movement and shooting working with xin, but this is giving me grief.
 
In my step event, I start by checking for the start button press and assigning the result to a variable:

index = 0;
if(xin_update(index)) 
    {
         startButtonPressed[index] = xin_check_pressed(index,xb_start);
    } 
 
 
Then later in the same step event I'm checking if that variable is equal to 1 to pause the game. From the help file, I gathered that xin_check_pressed would return "true" (which is 1, right?)
       if (startButtonPressed[index] == 1)
            {
                //pause game stuff
            }
 
I also have it set to pause if the "P" key on my keyboard is pressed, and that works, so I konw the pause menu is working.
 
Any help would be super appreciated :) [edit: simplified code, still no worky]

 

If you're using Studio, you might as well give the new built-in gamepad support a try, too. Check it out in the manual.


  • 0

Click the banner to check out my game, Suh Burb!

XPTintI.gif

Add me on Steam! Let's talk about making games!


#42 ryandebraal

ryandebraal

    GMC Member

  • GMC Member
  • 75 posts
  • Version:GM:Studio

Posted 25 June 2013 - 08:01 AM

I am new to extensions in Game Maker

I installed the .gex file and it shows up in my project...now what do I do?

 

I placed this code in the Step Event and it returns an error

 

//Update Input
index = 0;
if (xin_update(index))    {

if(xin_check(index, xb_right) == true) {
 script_execute(right_down);
}
     }

it returns this error:

FATAL ERROR in
action number 1
of  Step Event0
for object obj_character:

call to non-existent script
 at gml_Object_obj_character_Step_0 (line 15) - if (xin_update(index))    {

Is there something I need to initialize first? Is the proper implementation? I only guessed that the code needed to be in a step event so that it was constantly "polled" for data.


  • 0

#43 dasrkrain

dasrkrain

    GMC Member

  • GMC Member
  • 204 posts
  • Version:GM:Studio

Posted 27 June 2013 - 08:28 PM

I am new to extensions in Game Maker

I installed the .gex file and it shows up in my project...now what do I do?

 

I placed this code in the Step Event and it returns an error

 

//Update Input
index = 0;
if (xin_update(index))    {

if(xin_check(index, xb_right) == true) {
 script_execute(right_down);
}
     }

it returns this error:

FATAL ERROR in
action number 1
of  Step Event0
for object obj_character:

call to non-existent script
 at gml_Object_obj_character_Step_0 (line 15) - if (xin_update(index))    {

Is there something I need to initialize first? Is the proper implementation? I only guessed that the code needed to be in a step event so that it was constantly "polled" for data.

You're missing the script right_down. Find my instructions a few posts back on the second page. They are very easy to follow and don't have to be used for a ship only. They can be used for players as well. They don't require any scripts so it should be easier for you. And delete everything else you've added so you don't mess anything up.


Edited by dasrkrain, 27 June 2013 - 08:29 PM.

  • 0

#44 sournote103

sournote103

    GMC Member

  • GMC Member
  • 100 posts

Posted 08 August 2013 - 08:40 PM

For some reason, when I use this in Game Maker Studio and plug in my controller, it recognizes that it's plugged in, but I can't actually get it to recognize any input.

Oddly, when I used the .gmk example, it works perfectly.

 

EDIT: Never mind, I fixed it.


Edited by sournote103, 08 August 2013 - 09:11 PM.

  • 0

#45 marketto

marketto

    GMC Member

  • New Member
  • 4 posts
  • Version:GM:Studio

Posted 14 August 2013 - 05:45 PM

Hi all guys !!!

I'm new to GM:Studio , and i'm in trouble with this esxtension . . . I'm wprkin' on a vertical shooter like 1943 . . . .No problem for the movement of my ship , but i don't know how to shoot a bullet !!! How can i shoot a bullet pressing the "A" button on my x360 pad ?

I already have the ship and the bullet sprite , can you explain me what kind of code i must use to shoot ?

Sorry for my poor english , i'm from Italy  . . . Thanks a lot !!!


  • 0

#46 marketto

marketto

    GMC Member

  • New Member
  • 4 posts
  • Version:GM:Studio

Posted 16 August 2013 - 10:34 AM

no one can help me ?? :(


  • 0

#47 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 17 August 2013 - 03:40 PM

Check the help file linked in the first post, it tells you which codes you use for what. For checking for button A you'd do a xin_check(index, button); where button is xb_a. Read the help file here: http://www.jacksonya...m/Xin/help.html


  • 0

#48 Greenhawk

Greenhawk

    Gue Games

  • GMC Member
  • 722 posts
  • Version:GM:Studio

Posted 17 August 2013 - 03:57 PM

"you da you da best" -drake


  • 0

Games Made:

 

Youtube Channels:

One of the many GMC Gurus.


#49 marketto

marketto

    GMC Member

  • New Member
  • 4 posts
  • Version:GM:Studio

Posted 18 August 2013 - 09:27 AM

thx a lot ! ;)


  • 0

#50 marketto

marketto

    GMC Member

  • New Member
  • 4 posts
  • Version:GM:Studio

Posted 18 August 2013 - 10:51 AM

Ok, i see the help file , but it's too approssimative . . .

where i insert the code "Xin_check(index,button)" ? In "step" or in "Create" ??? and i must insert it in the ship object or in the bullet object ???
 

tnx a lot !!


  • 0