Relative bullet angle not working

0 favourites
  • 5 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • So I have this bullet test thing, and I want to have the enemy constantly aim at the player, but any time the enemy is at any angle other than 0, all of the bullet patterns break instantly. I can't tell if Im being really dumb, or what, but I can't figure it out.

    Heres the capx:

    (Removed capx as this was fixed)

  • I don't understand what you are trying to achieve.

    You have a gazillion of actions like "Bullet set angle of motion to Bad.angle+N", but your Bad.angle is always 0, because it doesn't rotate. So when you add 80 or 90 degrees to it, the bullet flies down, as it supposed to.

    If you want to aim at the player, you need to set angle of motion to angle(Bad.x, Bad.y, Player.x, Player.y)

    Or, since you have "Set angle=Yes" setting on your bullet, you can simply use "Bullet set angle towards position Player.x, Player.y"

  • I have 4 bullet patterns set up, if you run the project and press the number keys you can activate each bullet pattern and see what it does. But you'll notice that any time you rotate the enemy, whether its through code or simply clicking on it and rotating it in the layout, all of the bullet patterns break.

    Code like this: Set Bullet Angle | Bad.Angle + 90

    Is specifically there so that instead of using hard angles like 90 degrees, I can have the enemy pointing in any direction and have the bullet pattern function the same way but tilted at an angle.

    For some reason this doesn't work, and I'm not sure why

    As a side note, patterns 3 and 4 seem to work fine, as they function off of separate things coming off of the enemy and those spawning bullets.

  • There are two ways to fix it:

    Change "Set angle=No" in Bullet behavior and use "Bullet0 set angle of motion to Bad.angle+N" action.

    Or keep "Set angle=Yes" and change all action to "Bullet0 set angle to Bad.angle+N"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you! It works perfectly now. That was much easier than I thought it would be.

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