How can I work with the function (√)?

Benjamin_m5Benjamin_m5 Member Posts: 646
edited April 2012 in Working with GS (Mac)
Hey there everybody
I've a little question for my new game i'v been working on

How can I calculate the diagonal of a square?!

my constrain attribute:

max((0+(( self.Size.Width */2)),min((320-( self.Size.Width /2)), game.Mouse.Position.X ))

Now my problem is...I want replace the "self.Size.Width" with "((√2)*self.Size.Width)" but this did'nt work
How can I calculate the diagonal of a square in the GS creator?!

I hope someone can help me
---
Benjamin

Best Answer

  • AppTekAppTek Posts: 152
    edited April 2012 Accepted Answer
    No problem, ill just tell you what I did. I just made a new attribute and called in diagonal. Then I made a new actor then dragged it onto the scene. I made sure the sides were the same. Then in the new actor, create a constrain attribute and constrain the attribute diagonal to self.width*sqrt(2).
    If you need more help, email me at support@apptekgames.com

Answers

Sign In or Register to comment.