Enemy attack problem for Priate Game

0 favourites
  • 4 posts
From the Asset Store
Warrior on Attack
$12.80 USD
20% off
Warrion on Atack is a very fun survival game. Your goal is to defeat the endless wave of enemies.
  • Hello everyone, I am developing a pirate game. But I am having problems with the ball shots of enemy ships.

    I prepared an artificial intelligence, but I have a problem with enemy's aiming and shooting at me. When player enter a certain area, they need to translate their right or left ships's body for this player, then they have to shoot player. But I can not setting this. I will put an example screenshot for this. In short, I am having a problem with artificial intelligence's aiming.




  • I can kind of see what you're asking but not 100% clear. Wouldn't the rotation of the ship come under normal movement and steering, have you got that implemented already?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • One way is to have the rotate towards target position, then the rotate 90 degrees + or -, then fire and repeat. to do this so it looks good is going to require math to find the proper angle from the beginning.

    I saw this when it was first posted and I was going to figure out the formal way but I just don't have the time this weekend. It is something I'm interested in though.

  • I figured it out and it's 10x easier than I thought.

    assuming your ship sprite is facing right in the animation editor, then it's angle is zeroed.

    Action: set the ship angle to angle(ship.x,ship.y,target.x,target.Y) + 90 (starboard guns)

    You can - 90 to align to port.

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