angle check not working

Get help using Construct 2

Post » Sat Nov 10, 2012 5:37 pm

Hi All,

I was wondering if anyone can help me. I am trying to develop a shape matching puzzle game. I want to match my shapes by shape, height, width and angle. The problem I am having is matching the angle. For some reason this isn't working. If you look at my capx, you will see I have created a group call correct which carries out all the checks. This event was initially working correctly, but since adding the angle check (last condition) the event no longer works. I have tried increasing the 'within degrees' tolerance to 10 but it still doesn't work. I dont know a different way to write this condition, can anyone help.

https://dl.dropbox.com/u/101200636/Shapematch-updated.capx

Thank you,
unplugged
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Sat Nov 10, 2012 5:54 pm

I don't have C2 available right now, but maybe you could try and use "Compare two values" and then use the anglediff expression instead of the "Within angle" condition.

Something like this:
[code]+System: Compare two values 'anglediff(Shape1.Angle, Shape2.Angle) = 0'
-> Do stuff[/code]
But hitting exactly 0 if you're rotating freely is pretty hard, so you may need to use 'anglediff < 1' or something instead of 'anglediff = 0'.Nimtrix2012-11-10 17:58:49
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Nov 10, 2012 7:20 pm

Hi @Nimtrix

Thanks for your suggestion but my shapes dont freely rotate, they only turn at 90 degree angles. So I dont know why the way I wrote it doesn't work.

B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Sun Nov 11, 2012 2:30 pm

Hi @Nimtrix

Thanks for your help. I tried the anglediff expression making it equal to or less than 0.5 and it worked. I'm so pleased as I have been trying to fix this for a while.

By the way, do you know why the 'within 0.5 degrees' condition didn't work. I would be useful to know so I can learn from it. It seem to make sense logically and therefore made it hard for me to see why it didn't work.

unplugged
B
18
S
4
G
2
Posts: 77
Reputation: 1,588

Post » Mon Nov 12, 2012 1:58 pm

I'm not really sure, but I find the expression much more reliable, in my experience it has worked on many occations where the "Is within angle" condition has failed. Maybe someone else knows if there is any difference?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests