360 controller

  • i am trying to make an over the top shooter game, similar to geometry wars, using the xbox controller. i have tried a few different things like:

    left analog X axis > 0 then move right

    and the same for up left and down, this works great, the character moves in the correct directions.

    but now i tried the same thing with looking,

    gamepad right analog x axis rotate 90 degrees and toward 0

    90 for up, 180 for left, and 270 for down. then went to even say,

    If right xaxis > 0 AND right yaxis > 0, then rotate 90 toward 45 degrees.

    unfortunately, some of these work, and some do not. and i only think some work because up down left and right worked just fine, but the character sometimes starts looking at a 45 degree angle... im just wondering if theres an easier way for xbox controls? its taken 12 code bunches just to use the move and aiming and its not close to perfected.

    picture of my broken coding

    imgur.com/i85VDb9

  • The problem is that you're rotating the object like that, probably to have a "smooth" feeling to the rotation, right? You should just set the angle degree directly to what you want using "Set Angle" instead of "rotate to angle".

    And to make diagonals works, you gotta check if it's between 0 and 50, I think. For instance, when you press up on the analog, the Y goes to -100 and X is 0, but if you press it UP + RIGHT, the Y is -50 and the X is 50.

    If you press it to the right, Y is 0 and X is 100.

    Probably you could translate these numbers directly to angles, but I wouldn't know how to do that..

  • This question came up earlier today, and I answered it already, but here's an example capx that includes movement controls.

    It's pretty rough, but it functions well enough.

  • you can use the angle the stick is at to move things around

    angle(0,0,Gamepad.Axis(0,0),Gamepad.Axis(0,1))

    after this you just need to add a "move forward" action when "something"

  • im gunna be honest and say i have no idea what a (0,1) would even represent. 0 no and 1 for yes? meaning if it being moved? please describe a bit more.

  • Thanks Geo, that looks awesome, im going to try it out now

  • sxespanky The manual and tutorials will teach you what the different numbers are.

  • So i've tried Both Geometrix, and sargas, your methods, but when i go to look, now its stuck at - Looking at the top left area, indefinitely, moving the stick around it will try and look about 1-2 degrees differently, but thats it. ill go find the controller tutorial, wherever this may be.

  • Actually, oddly enough, there is no tutorial for using the gamepad object. The manual entry, however, does explain exactly what the 0 and 1 means. If you're not willing to do at least a modicum of research on your own, then you're going to have a lot more trouble than just getting gamepad movement to work.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • sxespanky

    Gamepad mapped

    i think you'll should get what you need from that. ( I actually made that capx originally to test how messed up were the sticks on my controller xD)

  • GeometriX - ive done a ton of searches to get this to work, and gamepad stuff that ive seen goes into brief descriptions what each outcome is of statements, i just haven't found the correct text on a thorough description on the gamepad object. after plugging the code into the RIght control stick, and disabling mouse function, it works.

  • I don't see how the mouse object would interfere - that's a little odd - but I'm glad it's at least working now.

  • because one line was Sprite always look at mousex, mousey. so i need to make an actual menu before the game starts up and pick mouse and key or controller. right now the mouse was disabled, so if you wanna try out this so far, be my guest.

    dl.dropboxusercontent.com/u/113498175/Space%20Bug%20Attack/index.html

    ~B Resets game

    ~Right trigger fires

    ~when dual wielding left trigger fires other weapon.

    ~killing the larger green enemies spawns more enemies and also drops a weapon upgrade kit after death.

    i have more weapons and levels and eventually animating every enemy but for now its all just place holders. ill prolly end up buying the personal version within a few months when i get extra cash in pocket.

  • sxespanky

    Gamepad mapped

    i think you'll should get what you need from that. ( I actually made that capx originally to test how messed up were the sticks on my controller xD)

    Hello, I was searching around the forums for similar tips and I came upon this topic which more or less summarizes what I am trying to make. Unfortunately the capx link you provided seems to be outdated... could you perhaps provide another?

  • Are attachments no longer available? I was going to upload it to the forums, but there doesn't seem to be a way anymore...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)