Help me, I'm blocking.

  • Hello, how can I get the enemies to attack me with a projectile? Thank you in advance for your answers and sorry if I am not clear in my remarks, I speak very poor English and I help myself with a translator.

    dropbox.com/home

  • Hello, how can I get the enemies to attack me with a projectile? Thank you in advance for your answers and sorry if I am not clear in my remarks, I speak very poor English and I help myself with a translator.

    https://www.dropbox.com/home?d=1&preview=fred+(18).c3p

    i get this when i try to download your file.

    but u can make enemies attack by having 2 sprites,

    1 sprite for the enemy

    1 sprite for the bullet or projectile

    for the enemy to start shooting we need a condition that will make him shoot and an action to create the bullet which will go towards the player position. We also need the bullet behavior for the projectile to move and untick set angle on the behavior.

    condition can look something like this

    Condition

    system/compare two variables

    distance(enemy.x,enemy.y,player.x,player.y) =< 100

    Action

    enemy.spawnanotherobject. bullet(or what the name of the projectile is)

    under that we put another action for enemy

    Enemy.BulletBehavior.SetAngle to Angle(self.x,self.y,player.x,player.y)

    Enemy.bulletbehavior.setangleofmovement to Angle(self.x,self.y,player.x,player.y)

    Then we need a condition to destroy the bullet and subtract life form player

    Condition

    Projectile on collision with another object "player"

    Action

    Player subtract from variable "life" _ 1

    Projectile Destroy

    now the variable life can be global or local on the player himself.

    if you want a game over on the player life = 0

    we do condition

    Compare variable "life"

    if life =<0

    Action

    Player.destroy

    Reset global variables

    Restart Layout

    kinda that is the logic of things.. now you can alter the reset variables or restart layout the way you want in order to suit your needs.

    Hope it helps you also make sure you look at the community blogs and tutorials there are plenty of tutorials that help you achieve this and more.

  • Thank you very much for your answer but as I don't understand English very well I didn't arrive. Is there anyone who could modify my game directly for me, I thank you in advance

    dropbox.com/s/3xora67jq1tz1cc/fred%20%2820%29.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm desperate.

  • You could do it like gamecorpstudio showed you using Distances

    or

    you could use Line Of Sight also

    I couldn't modify your C3 file as it's above the free version but here is a C2 Capx that you can open on C3

    The range of Fire 400

    CoolDown Between Fires for each Enemy 1 sec

    you can modify them at your will

    https://www.dropbox.com/s/7fkktwqre7winq5/Attack%20Player%20on%20LOS.capx?dl=0

  • thanks a lot to both of you and for your demo, I looked at it and finally understood, thanks to both of you for being a great help, I can finally progress in my prototype

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