avengers war

Avengers Game

Let’s make a card game about Avengers!

inner_war

You should have something like this by the end of the following two weeks:

result

You should download the following zip file and extract them :

related_file_download_here

This includes the following pictures:

captain

hulk

thor

ironman

And a text file to show the informations about heroes:

cards

How to draw

Read cards file

  • Cards aresaved in a file “cards.txt”

  • name, power,intelligence, image (separated by ,)

  • Read file, getdata



cards = dict()
fhand = open('cards.txt')
for line in fhand:
    name, power, intelligence, image = line.strip().split(',')
    cards[name] = [power, intelligence, image]
    

Show the cards

  • Use register_shape or addshape
  • You can addgif picture as a shape!
  • You can add acombo of coordinates as a shape:
import turtle
t = turtle.Turtle()
t.up()
t.ht()
screen = t.getscreen()
style1 = ('Arial', 14, 'bold')
style2 = ('Arial', 20, 'bold')


cards = dict()
fhand = open('cards.txt')
for line in fhand:
    name, power, intelligence, image = line.strip().split(',')
    cards[name] = [power, intelligence, image]
    screen.register_shape(image)
fhand.close()

Use write() to write words, use style definition for different words.

import turtle
t = turtle.Turtle()
style = ("Arial",14,"bold")
t.write("hello",font = style, align = 'center')

To be done

Try to compose your code and make the following demo:

result1