Dynamically Changing Chances for Attacks?

  • I have a slash-em-up game in the works and am working on enemy AI.

    I have a very black and white system where one hit kills and parries block all damage. This makes camping very easy for the player to just sit still and slash away at incoming enemies.

    But I want to change that, so I have put a global variable that increases and decreases based on whether the player is sitting still, or jumping about and getting more involved.

    This design is intended to have the player make choices as to wether to be sitting still and risk enemies trying to jump over them, or have them use ranged weapons (which require a different kind of block).


    the player can jump about and the enemies will be less likely to used ranged weapons/jump, but more likely to swamp the player in other ways.

    So I have global variable that goes positive in the player sits still for too long.

    I want each enemy to have a "chance" to either charge & jump, or use a weapon when within a distance to the player and when the player has been sitting still.

    Currently, ALL of the enemies jump or used ranged weapons when the player has sat still, but I need to think of a way to make it a % "chance" for each individual enemy based on the global variable.

    Are there any handy conditions or expressions people can recommend I take a look at?

    Please refrain from explaining exactly how to do the above, as I learn better when I am pointed in the right direction, but don't have to follow specific instructions.

  • One approach would be to use the random math function and add its result to your global variable. If its over a certain value, then you can have it execute things differently.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another approach is to assign certain values to various different actions that the player is doing like you were talking about.

    add all of these up, and then based on the performance of the player the enemies behave differently. That way the game is a bit more random and harder for better players.

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