Tutorial - Setting up a controller

Learn how to make certain types of games and use gameEditor.

Re: Tutorial - Setting up a controller

Postby SuperSonic » Wed Jan 25, 2012 10:00 pm

Ok, the controller works with the new drivers but still nothing happens when I run your example :(

Have you ever had problems like this?
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Tutorial - Setting up a controller

Postby Hblade » Wed Jan 25, 2012 10:05 pm

not really o-o

I'l try and help as much as possible. o-o see if the buttons work.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: Tutorial - Setting up a controller

Postby SuperSonic » Thu Jan 26, 2012 8:48 pm

Ok, will do. I'll let you know what happens :)
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Tutorial - Setting up a controller

Postby SuperSonic » Fri Jan 27, 2012 3:49 pm

It didn't work. I tried all of my buttons and even the analog sticks again. Nothing :(

Here's the code I used on my actor's draw code:
Code: Select all
float ls_XAxis = GetJoystick1Axis(0);
float ls_YAxis = GetJoystick1Axis(1);
int i;
int Button[14];
for(i=0; i<14; i++){
Button[i] = GetJoystick1Button(i);
}


xvelocity=ls_XAxis/10000;
yvelocity=ls_YAxis/10000;
if (Button[0])
{
    r = 89;
    g = 0;
    b = 0;
}
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Tutorial - Setting up a controller

Postby SuperSonic » Fri Jan 27, 2012 3:56 pm

Never mind. It works now :shock: I don't even know what I did :lol:

Ok cool. I'm gonna finish your tutorial Hblade :D

*edit: Whoops, I didn't realize that that was the end of the tutorial haha :lol: Plus one for you Hblade :wink:
A tree never hits an automobile except in self-defence.

Want to use your joystick or controller with Game Editor? Check out my controller engine =D
User avatar
SuperSonic
 
Posts: 1444
Joined: Fri Sep 24, 2010 9:24 pm
Location: Anywhere
Score: 72 Give a positive score

Re: Tutorial - Setting up a controller

Postby Hblade » Fri Jan 27, 2012 8:15 pm

Thanks ^^
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4370
Joined: Fri Dec 08, 2006 11:14 pm
Score: 169 Give a positive score

Re: Tutorial - Setting up a controller

Postby Zivouhr » Thu Jun 26, 2014 11:30 pm

This controller layout programming Tutorial is helpful, thanks!
Tomb of Twelve Official Site http://www.fsudolart.wordpress.com Created on Game-Editor!!
User avatar
Zivouhr
 
Posts: 119
Joined: Sat May 17, 2014 2:12 pm
Score: 3 Give a positive score

Re: Tutorial - Setting up a controller

Postby Zivouhr » Sat Jul 05, 2014 2:51 pm

Hblade wrote:I doubt it o-o Try this code in a simple draw actor


Global Code:
Code: Select all
int BTN[10];
double AXIS[2];
void SetupPad() {
    int i; for(i=0;i<9;i++) {
        BTN[i]=GetJoystick1Button(i);
        }
    AXIS[0]=GetJoystick1Axis(0);
    AXIS[1]=GetJoystick1Axis(1);
}


Now for Draw Actor:
Code: Select all
SetupPad();
if (AXIS[0]>10000) {
    x+=5;
}

Move the joystick (Or Dpad) to the right and see if he moves :)


Thanks for all of the good information for coding a controller HBlade.
I have a USB PC/Mac SuperNintendo Controller hooked up with the D Pad and 8 buttons including select and start. So far, all of the buttons respond and work, but the D-Pad to control the character's movements is totally unresponsive no matter what code I have entered so far.
I tried setting it up as suggested, then tried setting it up as a button only with the Axis instead, and then tried assuming it might be an additional button beyond the original 8. Sadly, I can't get that D-Pad to register any response even though the other buttons work perfect.

Any ideas how to get it working with some new coding? Thanks. I wonder if this has happened to others with a similar pad.
Tomb of Twelve Official Site http://www.fsudolart.wordpress.com Created on Game-Editor!!
User avatar
Zivouhr
 
Posts: 119
Joined: Sat May 17, 2014 2:12 pm
Score: 3 Give a positive score

Re: Tutorial - Setting up a controller

Postby knucklecrunchgames » Thu Aug 14, 2014 12:34 am

Hey. Is there a ged file with this example? And can you make a multiplayer game with other controllers? If possible I will make my new game with game editor. :D
Please donate to Knuckle Crunch Games for a construct 2 license
User avatar
knucklecrunchgames
 
Posts: 903
Joined: Wed Nov 21, 2012 8:01 pm
Location: In gameEditor.exe
Score: 12 Give a positive score

Re: Tutorial - Setting up a controller

Postby Zivouhr » Wed Oct 29, 2014 2:06 am

knucklecrunchgames wrote:Hey. Is there a ged file with this example? And can you make a multiplayer game with other controllers? If possible I will make my new game with game editor. :D


A GED controller setup example would be very helpful, agreed. One where we can press play, and it'll allow us to control the item with the controller and buttons to jump, etc. I think maybe my controller is broken or incompatible, even though the buttons can be assigned and work (DPad still not moving the character). He just floats to the right and gets stuck on the wall.
Tomb of Twelve Official Site http://www.fsudolart.wordpress.com Created on Game-Editor!!
User avatar
Zivouhr
 
Posts: 119
Joined: Sat May 17, 2014 2:12 pm
Score: 3 Give a positive score

Re: Tutorial - Setting up a controller

Postby lcl » Wed Oct 29, 2014 10:02 am

Zivouhr, does your controller have a button for changing between different controlling modes?
My controller has a mode button for changing whether to use the D-pad or the left analog stick. My D-pad doesn't response if the Mode settings is on the wrong state (obviously). You may have the same kind of a problem.

Also, it really may be that your D-pad is is treated as extra buttons. Have you tried accessing the buttons up to number 14? It depends on the controller, which number is tied to which button. Also, if you want, you can have a look at this: viewtopic.php?f=4&t=11212
User avatar
lcl
 
Posts: 1932
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 203 Give a positive score

Previous

Return to Tutorials

Who is online

Users browsing this forum: No registered users and 0 guests