Drawing a line at an angle

gruffman

  • *
  • Posts: 564
I would appreciate any help on this, my brain is too tired to get this right.

I want to draw a line from a set starting point on screen (eg, 320,240) for 100 pixels at an angle of 36degrees

i can't see a code block to do the angle part...?

i suspect i need to calculate the end point first then draw a line to it directly
Now available for all Android Devices - Happy Face Concentration
My Games To Date
Find A Face / Hero Of Oda / Snakes And Ladders
Hungry Monkey available at fgl.com for Sponsorship
My site - Gruffgames.com

JeffreyDriver

  • Posts: 2098
You can calculate it manually with existing blocks but there's extensions that can make life easier.

Easy Math extension or Drawing Utilities extension.
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

Luyren

  • *
  • Posts: 1707
For reference, your x and y points would be (if I'm not mistaken):
X= Radius*Cos (Angle)= 100*Cos (36)
Y= Radius*Sin (Angle)= 100*Sin (36)

And you'd add that to your starting position. But as JeffreyDriver said, you can use those extensions for this and other stuff.
Working.