Avengers War
Avengers Game
Let’s make a card game about Avengers!
You should have something like this by the end of the following two weeks:
Related Files
You should download the following zip file and extract them :
This includes the following pictures:
And a text file to show the informations about heroes:
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()
Print words
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: