How do I make a fighting CPU?

0 favourites
  • 4 posts
From the Asset Store
A well commented fighting game template to learn from or use as a base for your own game!
  • How do I make a CPU, that fights against a player the same way one fights in Smash Bros. and can dodge, shield, and attack. Mostly attack.

  • 1 problem at a time...

    You can simulate button presses, when certain conditions are met.

    For example... If the CPU is 50 pixels from the player, simulate attack button. (or roll then attack)

    I would highly recommend having a randomness element added, so it picks from a list, that way it seems to have a mind of it's own.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No such thing as AI in this engine. You gotta build it yourself. Have the character calculate its distance to player and act accordingly. Randomize variables and determine their next events by the resulting numbers. Simulate movement by giving the character a movement behavior, but disable its default controls so player can't control them.

    From my experience making AI is a very long process of hit and miss. You gotta start simple and add to that. First start by making the enemy move and stop when required. Then make them jump randomly at certain distances. Then add animations and events for them to simulate attacks. One piece at a time.

    One good tip I can give to you is to make a Hitbox (the sprite that has the movement behaviors and such, and is invisible) and Animation sprite (the actual character and its sprites) seperately. Pin the Animation sprite to Hitbox and make the Hitbox invisible.

  • Make sure you use timers on certain skills. You don't want your NPC casting its best spell every 2 seconds. You could also add a "Hard" or "Easy" mode and adjust those timers accordingly.

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