21 Comments

  1. Wow I needed a simpler explanation to start wrapping my head around classes. I’m lost at school and a lot of videos on YouTube we’re going right over my head. Your video was perfect! Thank you!

  2. "…basically a class is an easy way ***ing groups similar variables and functions together." What is ***? breaking? making? creating? Can't understand the word. @0:15

    Edit: I probably understood it. "… way we can group similar variables…"

  3. made a simple 1 vs 1 game, here's the code for it:

    import random

    print("Welcome to King of Fighters!n")

    p1Name = input("Player 1 enter your name!n")
    p2Name = input("Player 2 enter your name!n")
    turn = 0

    print("Welcome "+p1Name +" and "+p2Name+" ,are you ready to RUMBLE?!n")

    class Player:
    life=10

    def attack(self):
    damage= random.randrange(1,10)
    self.life-=damage
    print("Oponent lost "+str(damage)+" HP.n")

    def block(self):
    damage= random.randrange(1,5)
    self.life-=damage
    print("Oponent lost "+str(damage)+" HP.n")

    p1 = Player()
    p2 = Player()

    while p1.life>0 and p2.life>0:

    if turn is 0:
    print("Player 1, pick your move!n")
    print("Press 1 to defend yourself.n")
    print("Press 2 to attack your oponent.n")

    optionPicked = str(input())
    if optionPicked is "1":
    p1.block()
    elif optionPicked is "2":
    p2.attack()

    turn=1

    elif turn is 1:
    print("Player 2, pick your move!n")
    print("Press 1 to attack your oponent.n")
    print("Press 2 to defend yourself.n")

    optionPicked = input()
    if optionPicked is "1":
    p2.block()
    elif optionPicked is "2":
    p1.attack()

    turn=0

    if p1.life>0:
    print("Congrats, Player "+p1Name+ " Won!n")
    elif p2.life>0:
    print("Congrats, Player "+p2Name+ " Won!n")

Leave a Reply

Your email address will not be published.


*