Make fluid touch controls for Rotate Controls?

Get help using Construct 2

Post » Sun Feb 19, 2012 8:19 pm

I'm looking at porting over a tutorial I've done to my android and just wonder is there anyway I can get fluid rotation when touching the screen it only seems to face a certain when the screen is 1st touched. I'm wanting it to face the direction of the finger constantly until the finger is raised off the screen. how can this be done?

Also how can I also do it so if I press a 'fire' button the character doesn't face that direction?

Thanks Matt
B
4
Posts: 4
Reputation: 508

Post » Sun Feb 19, 2012 9:05 pm

1st question, If I understand you correctly:


Mouse:
System.EveryTick
Mouse.MouseButtonIsDown(Left)
     -> Sprite.SetAngleTowardsPosition(Mouse.x, Mouse.y)

Touch:
System.EveryTick
Touch.IsInTouch
     -> Sprite.SetAngleTowardsPosition(Touch.x, Touch.y)
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Mon Feb 20, 2012 2:42 pm

Thanks this is just what I wanted!!

just need to find out how to do the second one now.

Thanks Again
B
4
Posts: 4
Reputation: 508

Post » Mon Feb 20, 2012 2:45 pm

I dont understand what you want for the second one, Explain it more and i'll probably be able to help.
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Mon Feb 20, 2012 3:16 pm

Also you should get rid of the mouse plugin and set the touch property "Use mouse input" to yes. You can then avoid duplicating code if there's nothing specific to the mouse required.

For the second question indeed, I'm not sure exactly what you're trying to achieve.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Mon Feb 20, 2012 3:23 pm

Wow I never knew the touch object had a "Use mouse input" property , you learn something new everyday !

Does that only work in preview or when exported aswell?
B
29
S
12
G
7
Posts: 740
Reputation: 7,849

Post » Mon Feb 20, 2012 3:27 pm

Hopefully when exported too.
I don't have touch device, so I can't test it, but there's no reason why it shouldn't work.
This feature has been added some releases ago.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Mon Feb 20, 2012 7:31 pm

Ahh sorry,

What I mean is if I have a object on the screen to use as a "fire" button say in the bottom left of the screen.

The player will always face that direction of the "fire" after touching "fire" button, therefore after every time I press the button I have to reset the direction I want the player to face
B
4
Posts: 4
Reputation: 508


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 21 guests