assign movements to the gamepad(noob question)

  • Hello guys:

    I'm trying to assing movements to the Microsoft Xbox gamepad with this code:

    gamepad 0  left analog x axis>0 
                                                              simulate platform pressing right
                                                              set not mirrored
                                                              set Inst var player_state_walk
    gamepad 0  left analog x axis<0 
                                                              simulate platform pressing left
                                                              set mirrored
                                                              set Inst var player_state_walk[/code:1ffhx7zi]
    But it doesn't seem to work.
    Does anyone know what i'm doing wrong?
    Thanks for your help.
  • Don't worry about it being a noob question. You could do worse

    It looks right to me. Maybe something else is wrong? Like if you forgot to assign the event sheet, or didn't include it in the one you've assigned. If you upload the .c3p I can have a look, instead of just guessing.

    As for the event sheet I've done like this before:

    Gamepad 0 left analog X axis > 80
    ->Simulate platform pressing right
    Gamepad 0 left analog X axis < -80
    ->Simulate platform pressing left[/code:1vxfng73]
    Alternatively, if you also want keyboard controls, you could make global variables for directions such as:
    PlayerMoveRight = 0
    PlayerMoveLeft = 0
    and then set it up like this:
    [code:1vxfng73]Gamepad 0 left analog X axis > 80
    Keyboard: ? is down
    ->Set PlayerMoveRight to 1
    ->Set PlayerMoveRight to 0
    Gamepad 0 left analog X axis < -80
    Keyboard: ? is down
    ->Set PlayerMoveLeft to 1
    ->Set PlayerMoveLeft to 0[/code:1vxfng73]
    And then:
    PlayerMoveRight = 1
    ->Simalate platform pressing Right
    PlayerMoveLeft = 1
    ->Simulate platform pressing Left[/code:1vxfng73]
    This way you can also throw in D-pad controls or WASD or whatever you want.
    Hope you find any of this useful.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • [quote Hope you find any of this useful. Thank for your response Eydi av Hamri I'll try to do it again and if i find the same problem I will use yours and the I will reply here again for you to know. Thanks a lot!
  • Don't worry about it being a noob question. You could do worse

    For unknow reason i started the tutorial from 0 and now works I'm not sure if it's what i did or the beta because this morning i add a variable in the properties and didn't appeared in the set value coding but when i right click in the family the instance variable is avaiable for coding....very weird.

    Thanks for your help!

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