How do I Do a object Rotation when touching screen?

Get help using Construct 2

Post » Wed Dec 28, 2016 6:47 pm

Hello,

I am working on a rotational shooter and when I touch the screen(or mouse click on PC for testing) the ship turns to where I pointed, quickly, awkawrdly....I am hoping for an actual rotation to the spot I am touching/clicking vs just a quick turn.

Does that make sense?

I use
Touch - on any touch start - Player1 = Set angle toward (touchX.touchY)

Thanks,
Rich
B
9
S
2
Posts: 104
Reputation: 975

Post » Wed Dec 28, 2016 10:23 pm

Retrieve angle by compare positio between touch position and ship position:
https://dl.dropboxusercontent.com/u/659 ... touch.capx
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Thu Dec 29, 2016 1:38 pm

Thanks for the file but I cannot open as you are on r240, I am only on r239. I went to the DL page and 239 is the highest available to the public?
B
9
S
2
Posts: 104
Reputation: 975

Post » Thu Dec 29, 2016 1:55 pm

You can download the latest beta version here:

https://www.scirra.com/construct2/releases/r241
B
9
S
3
G
1
Posts: 3
Reputation: 1,132

Post » Thu Dec 29, 2016 9:19 pm

Thanks - I was able to DL the Beta.

Alextro - I see how it works in your file, thanks. But it is not behaving the same way in mine. I click and it rotates some...but not all the way to the location of the onscreen clicking. I tried changing the last number from 0.1 ot 0.5 and it seems to move quicker to the spot but still not to the exact spot I am clicking.

https://www.dropbox.com/s/vxa5m0bmcrp9edw/controls.JPG?dl=0
B
9
S
2
Posts: 104
Reputation: 975

Post » Fri Dec 30, 2016 2:18 pm

I got it...I didn't edit your "Sprite" with "Player1" :)

It is rotating much better now. But not exactly what I want...I like the fluid motion it goes from clicking in different parts of the screen but it is too slow of a rotation. Increased 0.33 and that seems to be a good middle ground to get the rotation look with quick response time as well.

Thanks for your help!
B
9
S
2
Posts: 104
Reputation: 975


Return to How do I....?

Who is online

Users browsing this forum: Darknessed, dop2000 and 37 guests