This should be simple math here. what the heck?

0 favourites
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Angles are cyclical so it's not reliable to use linear comparisons with them. 225 degrees = -135 degrees = -495 degrees etc. If you're making a comparison expecting 225 degrees, you will fail to match the other mathematically equivalent cases, in particular -135 degrees.

    I'm aware Construct 2 in some places uses a 0 to 360 value, and in others it uses -180 to +180. But this is just a quirk of the way the equations work out and does not matter if you use angle-aware comparisons and calculations.

    The Sprite object's angle conditions ("is between angles", "is clockwise from", "is within angle") are cycle-aware so you should always use them instead. For example any of these conditions would work (followed by the same condition inverted for the other case): "Is between -90 and 90 degrees", "Is within 90 degrees of 0", or "Is clockwise of -90 degrees". I note that you're using a behavior's angle of motion instead of a sprite object, so it's kind of awkward to use those conditions (you'd have to have a dummy sprite set to the bullet's angle and use the sprite's conditions...) so I've put on the todo list to port those conditions over to the System object so you can use them for anything.

    I would really appreciate that. I was finding it pretty annoying that the "angle" had more useful conditions and actions than the bullet one, even though I couldn't use it without rotating the graphic unwantedly. Also, the bullet behavior has "compare speed" and "compare distance", but not "compare angle".

    Also, thank all 3 of you for actually being helpful. I mean, I admit some of that math stuff actually did go over my head. But at least you actually told me what needs to be done.

    I should also point out though, specifically in regards to the first of the three posts, that I wasn't always getting -135 for bullet behavior at 255. On another file (the one that guy uploaded), it returned -180 instead. When I tried using debug text in my own game, one time I even saw a negative sign with no number even. And then, angle for "moveto" had what I think was 255, actually return 40 point a bunch of digits, even though bullet never gave me decimals. Nothing was seeming to make sense or be consistent for me at all, even a little bit.

    I wound up doing what I want using moveto, but in a different way that doesn't check for angles. I guess this is still something that will take me a while to learn. but it's not gonna stop me from doing what I want to do and spreading love. <3

    Here is the final result of what I was trying to do here.

    I <3 cures.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)