 In this video, we are going to create a conflict system using the hazard recipe. The hazard recipe paves the way for our incentive systems, and is the core for upcoming recipes, including the boss battle recipe. This video is sponsored by the platform Essential Recipes ebook. The ebook is currently on pre-order, so it's your chance to get it with a 30% discount. A conflict system is when an entity offers passive or active opposition to players progress in the game. Some examples of conflicts include enemies, negative statuses such as burn, poison, freeze, etc. Other players in the case of PvP and mechanics such as traps, spikes, flame towers, etc. We call them hazards, as they offer danger to the player's avatar existence. I'll use the gutted asset library import feature to import the recipe into the project. This is quite an abstract recipe, as the overall setup is quite simple and most of its value comes from our own season. In other words, each game requires its own concrete implementations of its hazards, as they build up on the game team, and even on each individual level team as well. The essence of a hazard is that it somehow deals damage to players based on a trigger, but different from enemies, they don't have any intelligence in their decision making mechanism. That's why we call them mechanics nest little brothers, because they have a mechanical and predictable harmful behavior. So let's create our first hazard. It will be a bomb that explodes after it enters in contact with the player. I will set up the animated sprite 2D animations first, then I will add the hit R2D which is our hitbox. By default, it looks for collisions in the third collision layer, which I will rename to combat layer. This bomb will deal one damage and is not on the player's team, so it deals damage to players. Then based on the last frame of the boom animation, I will create a collision shape matching the damage error. By default, this collision shape will be disabled, we will only enable it when the bomb explodes and just for few frames. The bomb should know when the player is closed, so it triggers its explosion. So I will add the vision error to D as its child. This is a simple system that detects when something visible gets into a given vision or site area. For that, it looks for collisions in the fifth collision layer, which I will rename to visibility layer. Now let's choreograph what will happen once the bomb detects the player. For that, I will use an animation player and create an animation called explode. First of all, it will play their own animation, which will basically light up the bomb's wake. It should also disable the vision error collision shape. This should prevent the animation from triggering twice if the player reenters the vision error. And then it will play the boom animation after the on animation looks once. Then I will enable the hit error to the collision shape for a few frames and then disable it again. Finally, at the end of the animation, I will call the kill free method to remove the bomb from the scene tree. With the desired behavior in place, let's take the condition that will trigger it. I will create a new script for the bomb and connect the vision error to the error entered signal to a callback inside of it. I've made a method called explode that essentially plays the explode animation. So it's just a matter of calling this method inside the signal's callback. Using this same process, we can create a range of other hazards. For instance, I've made this crate pick that tricks the player. When it attacks that the player entered its vision error, it jumps, dealing damage to the player. So we've finished our first hazard, but remember, this is a two sided system. So let's set up the other side of the coin, the player. I will open the king pick scene and instance a hurt error to the and a visible error to the and set up their respective collision shapes. Then I will connect the hurt error to the damage signal to the king pick script. I will create a health variable and a coin health, sell the private variable to make the damage logic. The idea is to decrease the player's health based on the damage it received until it's zero, or rather, below one. Here we play the hit animation. When the health is below one, we play the dead animation. Then whenever the player gets damaged, we disable its physics and input process until the hit animation finished. Note that since this is a two sided system, we can do the same thing on the player, adding a hit error to the king pick and creating objects with hurt error to these. This was made using a recipe from the platform essentials cookbook. Get your copy with 20% discount before December 1st. Ready to make your dream game? Click the link in the description. In this video, we've created the core of our combat system. With this in place, we can enrich the game's world with other characters, while with enemies should be more specific. In the next video, we'll add a kamikaze pig using the bumping enemy 2d recipe. That's it, thank you so much for watching, keep developing and we'll see you next time.