Commit b8764725 by BellCodeEditor

auto save

parent ce0a9cdb
Showing with 26 additions and 15 deletions
class Hero:
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.hp=self.hp+50
self.level=self.level+1
self.attack=self.attack+4
yase=Hero("yase",300,20)
houyi=Hero("houyi",300,20)
yase.upgrade()
print(yase.hp)
\ No newline at end of file
import turtle as t
import random as r
t.setup(1000,800)
t.screensize(800,600,'skyblue')
def draw_circle(radius,color,y_position):
t.penup()
t.pensize(3)
t.fillcolor(color)
t.goto(0,y_position)
t.pendown()
t.begin_fill()
t.circle(radius)
t.end_fill()
def draw_bullet():
t.penup()
t.goto(r.randint(-200,200),r.randint(-200,200))
t.pendown()
t.dot(20)
draw_circle(200,'yellow',-200)
draw_circle(150,'red',-150)
draw_circle(100,'blue',-100)
draw_circle(50,'skyblue',-50)
for i in range(5):
draw_bullet()
t.done()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment