STEP 6: Let's cast a fireball spell! We will do this only if the user chooses a or the computer randomly selects "a".

  • Locate the if statement in cast_spell(). Replace the first pass with this function call: fireball(caster)

The fireball() function also needs to know who cast the spell, so we pass it the caster sprite so that the function knows where to throw the fireball!

  • Click Run now and choose option a to cast the fireball spell!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)