Make My AI throw a Gernade at certain angle.

0 favourites
  • 7 posts
From the Asset Store
Throw daggers and hit the most fruit! Watch out for the wind, if you run out of daggers you'll lose the game!
  • Hello guys , I have my Ai and I want him throw a gernade at the player and arrive at the players position. depending on the player position the arc of the gernade thrown should be bigger or smaller.

    I can get the gernade to arrive at the players position using the tween behavior but creating a arc is outside my expertise.

    Would anyone know how to create something like this and a little picture to give a example.

  • Hi, great example of trajectory calculation.

    howtoconstructdemos.com/trajectory-calculation-two-methods

  • Hi, great example of trajectory calculation.

    https://howtoconstructdemos.com/trajectory-calculation-two-methods/

    Thanks this helped a lot. I got the curve going on the bombs now but the issue im having is the best way to make bombs speed stay 0 once they get close to the player to simulate hitting the ground. since this is a top down game there is no ground to make them stop.

  • You can check the distance to the players.

    distance(bomb.X,bomb.Y,hero.X,hero.Y)

  • You can check the distance to the players.

    distance(bomb.X,bomb.Y,hero.X,hero.Y)

    This doesnt work becasue if the player is running around surely one of the bombs will not be in range and it will just fall through the floor and if the player keeps on runnning a certain direction then the bombs will then just start falling

  • > You can check the distance to the players.

    > distance(bomb.X,bomb.Y,hero.X,hero.Y)

    This doesnt work becasue if the player is running around surely one of the bombs will not be in range and it will just fall through the floor and if the player keeps on runnning a certain direction then the bombs will then just start falling

    I created an example of how I would use this in a game.

    We can't just throw grenades we need to add conditions that make the attack more real.

    --Each enemy should have a radius of attack and if the player does not approach him he does not see him and does not throw a grenade (you can see on the screen).

    --Each grenade should have a delay before the explosion, after the time has passed it explodes as in the real world.

    --Grenades can't be thrown with absolute precision they must have a spread of accuracy, enemies can't be absolutely accurate like Robin Hood.

    File c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > > You can check the distance to the players.

    > > distance(bomb.X,bomb.Y,hero.X,hero.Y)

    >

    > This doesnt work becasue if the player is running around surely one of the bombs will not be in range and it will just fall through the floor and if the player keeps on runnning a certain direction then the bombs will then just start falling

    I created an example of how I would use this in a game.

    We can't just throw grenades we need to add conditions that make the attack more real.

    --Each enemy should have a radius of attack and if the player does not approach him he does not see him and does not throw a grenade (you can see on the screen).

    --Each grenade should have a delay before the explosion, after the time has passed it explodes as in the real world.

    --Grenades can't be thrown with absolute precision they must have a spread of accuracy, enemies can't be absolutely accurate like Robin Hood.

    File c3p

    Ah this is what I needed! a timer , i didnt think of that.

    I agree with you on the bomb not being in the perfect position just didnt know how I can have it explode near the player and a timer does it.

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