Gamepad rotate and move

Get help using Construct 2

Post » Tue Feb 12, 2013 7:16 pm

Hi guys,

I'm using the gamepad. Any idea how to set it up so that a sprite will rotate so that it is pointing in the direction of the right stick, and moving based on the left stick.

Tried searching and the manuals, but it's a little tricky.

Any help would be appreciated.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 930
Reputation: 9,358

Post » Tue Feb 12, 2013 7:25 pm

THis may be what you are looking for... Analog Stick Trouble
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Tue Feb 12, 2013 9:28 pm

Hmm, not having much luck with that. Also, is it right that I have to push a button on the controller before the rotating even begins?

Surely there's an easier way to do this.

Rotate sprite angle to gamepad right analogue stick angle.

Wha?
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 930
Reputation: 9,358

Post » Wed Feb 13, 2013 4:04 am

one action is about as easy as it get's.
Right stick angle is angle(0, 0, Gamepad.Axis(0, 2), Gamepad.Axis(0, 3))

Also as for your other question in regards to requiring a button press. yes, this is a browser problem. The browser will not enumerate/acknowledge the controllers until any button is pressed. The best way around it. is to use a front screen.
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Thu Feb 14, 2013 10:17 am

@jayderyu

I can't get this working with the rotate to command. Do you mind having a look at the example I put above (I stupidly highlighted as "Wha?")
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 930
Reputation: 9,358

Post » Thu Feb 14, 2013 10:58 am

Try changing where you have rotate angle to just set angle - this will set your sprite facing the direction you are pressing

edit to add file:

but found out I cant post links yet - sorry.RamPackWobble2013-02-14 11:11:11
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
59
S
30
G
34
Posts: 1,194
Reputation: 23,767

Post » Thu Feb 14, 2013 3:39 pm

@RamPackWobble

Thanks, I noted that when I have is as set to it worked fine, but it's not the effect I want. I'd like the sprite to be able to rotate toward the direction of the stick, rather than just pop in the certain direction. Maybe I could try lerping if that's not working for me.
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 930
Reputation: 9,358

Post » Thu Feb 14, 2013 4:37 pm

try -

-----------------------------------------------
set up a global variable "AngleRequired" (number)

every tick

system - set AngleRequired to angle(0,0 gamepad.Axis(0,2), GamePad.Axis(0,3)


sprite rotate 1 degrees toeards AngleRequired

-----------------------------------------

you will also need to set up a dead zone on your joystick or it will turn towards 0 degrees all the time when not pushed.

https://dl.dropbox.com/u/143636437/temp/RotateGamepad.capxRamPackWobble2013-02-14 16:38:48
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
59
S
30
G
34
Posts: 1,194
Reputation: 23,767

Post » Thu Feb 14, 2013 4:58 pm

Isn't there some math fun you can do as well to make sure it rotates in the direction that the stick is closest to, for example you want it to rotate the 30 degrees to the place the stick is pointing as opposed to rotating the other direction 330 degrees to get there...
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Thu Feb 14, 2013 5:12 pm

...or even the further you push the joystick the faster you turn ...?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
59
S
30
G
34
Posts: 1,194
Reputation: 23,767

Next

Return to How do I....?

Who is online

Users browsing this forum: currypuff, makotto, Yahoo [Bot] and 19 guests