猫史档案馆


【Python作品分享】【去太空,趣编程】

用户:炑炑吖炑炑吖查看:0 回复:0 评论:0 创建时间:2021-05-01T13:33:38


【作品展示】

center_image

 

【作品介绍】

参赛作品

 

【作品源代码】

from turtle import *
import random

width = 1600
height = 1200
myscreen = Screen()
myscreen.setworldcoordinates(0, 0, width, height)

speed(0)
bgcolor('black')

def triangle(x,lr):
    if lr == 1:
        for i in range(3):
            fd(x)
            lt(120)
            print(pos())
    if lr == 2:
        for i in range(3):
            fd(x)
            rt(120)
            print(pos())

def 喵(x,lr):
    if lr == 1:
        for i in range(4):
            fd(x)
            lt(90)
            print(pos())
    if lr == 2:
        for i in range(4):
            fd(x)
            rt(90)
            print(pos())
def rectangle(x,y,lr):
    if lr == 1:
        for i in range(2):
            fd(x)
            lt(90)
            print(pos())
            fd(y)
            lt(90)
            print(pos())
    if lr == 2:
        for i in range(2):
            fd(x)
            rt(90)
            print(pos())
            fd(y)
            rt(90)
            print(pos())

#sun
pencolor('red')
fillcolor('red')
begin_fill()
up()
goto(width-200,height-500)
down()
circle(200)
end_fill()
#moon
pencolor('yellow')
fillcolor('yellow')
begin_fill()
up()
goto(-width//2+1000,-height+1500)
down()
circle(90)
end_fill()
#rocket
#三角形
up()
goto(width//2+50,height//2+300)
lt(135)
down()
pencolor('orange')
fillcolor('orange')
begin_fill()
triangle(150,1)
end_fill()
#一级
up()
goto(705.11,861.18)
rt(120)
down()
pencolor('silver')
fillcolor('silver')
begin_fill()
rectangle(150,250,2)
end_fill()
#正方形
up()
goto(705.11, 861.18)
fd(90)
rt(90)
fd(100)
down()
pencolor('blue')
pensize(3)
喵(25,2)
#二级
pencolor('silver')
up()
lt(90)
goto(769.81,619.70)
fd(37.5)
down()
begin_fill()
rectangle(75,175,2)
end_fill()
#三级
up()
goto(851.33,460.37)
back(37.5)
down()
begin_fill()
rectangle(150, 250, 2)
end_fill()
#火焰
up()
goto(879.81,209.18)
fd(60)
down()
pencolor('orange')
fillcolor('orange')
begin_fill()
rectangle(30,200,2)
end_fill()

hideturtle()
done()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页