assign movements to the gamepad(noob question)

Get help using Construct 3!

Post » Tue Jul 25, 2017 2:01 pm

Hello guys:

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



Code: Select all
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

But it doesn't seem to work.

Does anyone know what i'm doing wrong?

Thanks for your help.
B
7
S
1
Posts: 14
Reputation: 401

Post » Wed Jul 26, 2017 8:21 pm

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:
Code: Select all
Gamepad 0 left analog X axis > 80
->Simulate platform pressing right

Gamepad 0 left analog X axis < -80
->Simulate platform pressing left

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: Select all
Gamepad 0 left analog X axis > 80
OR
Keyboard: → is down
->Set PlayerMoveRight to 1
Else
->Set PlayerMoveRight to 0

Gamepad 0 left analog X axis < -80
OR
Keyboard: ← is down
->Set PlayerMoveLeft to 1
Else
->Set PlayerMoveLeft to 0

And then:
Code: Select all
PlayerMoveRight = 1
->Simalate platform pressing Right

PlayerMoveLeft = 1
->Simulate platform pressing Left

This way you can also throw in D-pad controls or WASD or whatever you want.

Hope you find any of this useful. :)
B
11
S
2
Posts: 5
Reputation: 1,309

Post » Thu Jul 27, 2017 6:40 am

[quote

Hope you find any of this useful. :)[/quote]

Thank for your response Eydi av Hamri :D

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!
B
7
S
1
Posts: 14
Reputation: 401

Post » Thu Jul 27, 2017 1:31 pm

Eydi av Hamri wrote: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!
B
7
S
1
Posts: 14
Reputation: 401


Return to How do I...?

Who is online

Users browsing this forum: JaredX and 0 guests