angle check not working

0 favourites
  • 5 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • 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 don�t know a different way to write this condition, can anyone help.

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

    Thank you,

    unplugged

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    +System: Compare two values 'anglediff(Shape1.Angle, Shape2.Angle) = 0'
    -> Do stuff

    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'.

  • Hi Nimtrix

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

    <img src="https://dl.dropbox.com/u/101200636/shapematch-screenshot.jpg" border="0" />

  • 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

  • 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?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)