2 player battle simulator step 4: defense and defense break functions

In this blog you will learn how to add in the defense feature as well as the defense break feature. this will make combat significantly better as there is a way to now block attacks but there is also a way to instantly destroy shields .

To start we will cover the knights defense which is called the Knight Shield. Just like all the other sprites so far u can either use one you like or one you that looks similar to mine it does not matter as long as it is the right size for your needs/requirements.

This was the shield I felt looked the best for my game and it has the right size and shape for my game as well as the right style for my medieval theme. To activate the knights shield will use the L key. With the code below

With this code the shield will show itself and then it will hide itself and it will broadcast the delete code. This delete message will tell the Warlocks magic bolt delete itself and this will happen as soon as the magic bolt comes into contact with the shield.

Now this could cause lots of problems to the game as now the sword has a very good counter and the shield is OP as there is nothing that can stop it which is why i will be adding the defense break feature.

For the Knight’s defense break feature he will shoot a large gust of wind that will destroy the enemy shield on contact. Once the shield is destroyed there is a slight cool down that will allow the knight to throw his swords at the Warlock.

Below is the image of the gust of wind as well as its code.

This is the sprite I chose for the gust of wind
This is the code for the knights defense break

As with all of my other sprites you definitely can change what they look like because these are just the sprites I thought were aesthetically pleasing. So now we have a counter to the shield and once we add the shield to the Warlock the major game features will be done and all we have after that is the background some animations and variables.

Thanks for sticking around to the end I hope you enjoyed reading this blog and hopefully your game is working as it should remember leave a comment down below if your code is not working or email me @[email protected] Also check out my YT channel called Drago Gaming link below.

https://www.youtube.com/channel/UCrlNUqQVBxLIbdltHQBdcYg