How can I work with the function (√)?
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
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
-
AppTek Posts: 152
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
Check that out, you should be able to modify the equation there to make it work.
Does anyone other know how this would work?!
---
Benjamin
Here is a quick project I made for you.
But I can't open that because i've got the GS-version 0.9.0
But thanks much
---
Benjamin
I wrote the "((√2)*self.Size.Width)" as "(self.Size.Width*sqrt(2))" and it works.
Thanks much
---
Benjamin