American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6 PM – Python OOP – Darin

April 8 @ 6:00 pm - 7:00 pm

What We Did Today:

  1. Continued the Monster Inheritance project.
  2. Implemented the start of the attack system.

Homework:

In your MonsterSystem project, do the following, and upload to google drive when finished:

Complete the sword attack method, where you have to get a random amount of damage to attack the monster with.

Also implement code for the monster to attack you. You will have to generate a random number from 0 – m.max_attack and reduce the player’s health.

Print statements after attacking and after getting attacked.

def sword_attack(self, m):
    # part of hw:
    # get a random amount of damage from 10-20 using r.randint()
    damage = 0 # replace this
    monster = self.monsters[m]
    monster.get_sword_damage(damage)

    # have the monster attack us with some damage that is random from 0 - monster.max_attack
    damageFromMonster = 0 # replace this
    # minus the player health
"""
example output:
You attacked dragon with 14 damage and the dragon has 86 health remaining.
dragon attacked you with 38 damage. Your remaining health is 962.
"""

Notes:

You can reach me at ddjapri@ayclogic.com for any questions.

Class notes: https://drive.google.com/drive/folders/1OwtesGpGH9qm7A9cPpFKe-gooY71zxc4?usp=sharing

Details

Date:
April 8
Time:
6:00 pm - 7:00 pm
Event Categories:
,
Verified by MonsterInsights