cruisehaser.blogg.se

Construct 3 ai
Construct 3 ai







construct 3 ai

When the enemy sees the character, it will move closer to its radius, when it doesn’t it will only stand still (for now, at least).

construct 3 ai

First is when the enemy sees that a character is near, second when it doesn’t see. Then add an instance variable called radius to family Enemies, enemy will attack the character when the character is in range of this radius, for beginning the radius value is 60 (in pixels), I have also changed the line of sight’s range to 150. First add a line of sight behaviour to family Enemies, this behaviour will determine whether the character is close enough to the enemy or not. Next I’m gonna add a simple AI to our enemy, for now the AI will only moves the monster closer when it see our character (it won’t attack for now). Lastly, don’t forget to change the event where our character attacks a little bit, so that the character will only attack when he is not in rest condition. This is because the value of attackCount every loop will be equal or bigger than 3, and we will start the timer every loop, this will result in the timer unable to count to the time that we set and then the state value will never become empty. We will end the “rest” state in this OnTimer event.ĭon’t forget to change the attackCount back to 0 in the event Friendly attackCount >=3, if not then Timer will not trigger an OnTimer event. Here we start the timer with the tag “doneRest” for 1 second (or however long you want it to be), after the set time the Timer will trigger an OnTimer event, which can be recognized by the tag that we gave it. The character will enter “rest” when their attackCount reach 3 (or whatever long you want the combo to be). Make two events that handles when player enter “rest” state and when that state ends. Then add an instance variable named state to family Friendly, this is where we will give the value of “rest” to mark that this character just attacked consecutively. Make a string constant variable with the value “rest”.

Construct 3 ai series#

This delay needs to be named for us to use it, I will simply name it “rest”, because the player is resting after delivering a series of attacks. We’re gonna have to implement something like this at the event when other party members attack.Īfter that we will add a Timer behaviour to family Friendly, this to make a little delay after the character finishes their attack according to their attackCount.

construct 3 ai

To avoid that I increased attackCount of attacking character in the place that I’m sure it’s the controlled character who attacks. Maybe you’ll ask: why not add the attackCount inside charaAttacks function? Because doing that will make attackCount of other party members add up when one character attacks. And then at the event where charaAttacks function is called (where button K is pressed for example), add 1 to the attackCount of the character. Add an instance variable called attackCount (a number) to the Friendly family, so that this limitation will also effect the other party members. I want to prevent this because attacking without stopping will make the gameplay becoma a button mashing type. If you look at it closely when the player press K repeatedly (or attack button on the gamepad), the character will attack without stop. Part 3 – Implementing the Battle Systemīefore I go on about making a simple AI, let’s take a look at how the character attacks.Construct 2 RPG Series by Aryadi Subagio ( Part 1 – RPG Basic Setup.









Construct 3 ai