How to set a Text to an angle?

Get help using Construct 2

Post » Mon Mar 19, 2012 12:41 am

Hi,
I have a cannon in a game and I would like to set a Text item to the angle of the cannon. I can set the text to the height of the cannon or other stuff and it works, but for some reason the text is unable to display the angle of the cannon.

I tried setting the text to both cannongun.Angle and Angle(cannongun.ImagePointX(0),cannongun.ImagePointX(1),cannongun.ImagePointY(0),cannongun.ImagePointY(1))
but neither one would work.

How do I get the angle? Thanks.
B
14
S
3
Posts: 16
Reputation: 1,231

Post » Mon Mar 19, 2012 1:17 am

It's possible the number doesn't show because your text object doesn't have room for all the decimals. Try using int(cannongun.Angle)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon Mar 19, 2012 6:31 am

I am fairly sure you just need to set the text to 'Cannongun.angle'
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Tue Mar 20, 2012 4:44 pm

Thanks, that worked.

I had tried using (int)cannongun.angle (like in Java), but I see scirra does it differently.
B
14
S
3
Posts: 16
Reputation: 1,231

Post » Wed Mar 21, 2012 10:01 am

Java is not Javascript. Don't mix the two.
B
25
S
8
G
7
Posts: 184
Reputation: 6,040


Return to How do I....?

Who is online

Users browsing this forum: h1k3, Unconnected and 0 guests