How do I assign different damage for different animations?

0 favourites
  • 4 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi, I want to build a game like Defender's Quest. I want to make towers with a few different attacks and different damage. For ranged towers, I supposed I can set the damage on its projectile collision. But how do I set different damage for MELEE towers? I can set different animations for it, but how do I determine which animations deal which damage?

    Further more, I want to ask how to do critical attacks?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I couldn't quite understand your question. You have a single tower that does 2 types of damage - ranged and melee, correct? Or you have two different towers 1 is ranged and 1 melee?

    This is pretty straight forward:

    Object -> Is Playing -> Animation Name -> Set this damage

    For the damage you can use the random expression. Say you want to do between 50 and 100 damage per hit you can assign it to random(50,100) or if you want only round numbers floor(random(50,100)). Using this for randomly assigning a critical hit could work as well - randomly hit for a random damage between 150 and 200.

  • ^ I meant like Defender's Quest. A tower with 5 skills, each skill can be either range or melee and deal different damage.

    And I have some more questions. I want to upgrade towers. How do you add new abilities like critical strike or slow to a tower after upgrading? Can I add attribute to it or do I have to change it to a new object?

  • hsm4ever

    As NicotineLL mentioned, you may just check the animation playing and set the base damage accordingly. For the critical, you can have a damageMultiplier on your damage calculations, which is set to 1 all the time, but set to 2 (or 3 or whatever you want) when you get a critical.

    Here's a very simple example, just so you get the gist of it:

    [attachment=0:1d0vii8s][/attachment:1d0vii8s]

    Click the buttons to change the animation. The chance of a critical is very high (10%) just to allow you to see it happen.

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