Step 6 – Basic Attacks

Player

Basic Attack


  • We are going to have 3 attacks. Our basic and special attack and our opponent’s attack. The great part about this section is that it’s a lot of copying and pasting. It may look like a lot at first, but you’ll get the hang of it!
  • First, we need to make a new function called “attack1” that will have an if and 2 else-if’s: regular hit, critical hit, and a miss. Just like normal Pokemon games!
  • To make that happen, we fill each socket with a Math “0% chance” block and then pick our numbers adding up to 100% (we use 80%, 15%, 5%).

  • Extensions


  • This section gives you the opportunity to use animations. In order to do that, you must click on the Advanced section and find “Extensions” all the way at the bottom.
  • Once there, find and click on “Animations” to load the plug-in. All done!
  • Note: It may already be in your sections.
  • Regular Hit


  • For our most likely outcome, the first block should be the Info block “change player 2 life by” that we fill with the Math block “pick random -3 to -8”. The numbers are up to you, but negative numbers lower health, positie numbers increase health.
  • If we use Sprites blocks “mySprite start spray effect”, we can add effects onto your opponents. Use the plus at the end to limit how long the effect lasts.
  • The other option is to animate our Sprites with the Animation block. There are presets we can use that have “(in place)” on them so our sprites don’t wander off.
  • We then add a 500ms pause to allow the animation to finish before moving on to the next block.
  • Finally, we want to add the Game block “show long text” to let us know what actually happened. Be sure to write it so we know who hit who. Make sure to change the variable names to match.

  • Critical Hit


  • Critical hits do a lot of damage, but they are a lot more rare. So our critical hits are going to be in our next lowest bracket.
  • First, we add the Info block “change player 2 life by -15”.
  • We can add animations or effects just like our last section.
  • And finally, we make sure the Game block “show long text” lets us know what happened.

  • Misses


  • Easy peasy misses. Just add the Game block “show long text” letting the player know they missed.
  • Enemy

    Basic Attack


  • Another easy one! All we need to do is duplicate our “attack1” and change the some things.
  • Make sure to change to “player 1” and change “opponent” to “trainer” and “trainer” to “opponent”.
  • You will also want to edit the long text to say that you’re opponent got the hits on you. Now is also a great time to change the animation lengths for both functions.