weixin_53014583的博客

私信 关注
bhnksdvijsoce
码龄138天

此人因为在上初中,所以学历只有初中

  • 3
    被访问量
  • 1
    原创文章
  • 暂无
    作者排名
  • 0
    粉丝数量
  • 毕业院校 中山火炬一中
  • 目前就职 中山火炬开发区一中
  • 于 2020-11-28 加入CSDN
获得成就
  • 获得0次点赞
  • 内容获得0次评论
  • 获得0次收藏
荣誉勋章
兴趣领域
  • #人工智能
    #Python
  • 最近
  • 文章
  • 资源
  • 问答
  • 课程
  • 帖子
  • 收藏
  • 关注/订阅

#哪错了? #带入模块 import pygame import sys import random #初始化屏幕、速度、颜色、两个对象,辅助变量 pygame.init() size=weight,height=700,700 screen=pygame.display.set_mode(size) speed=[0,0] color=(0,0,0) a=pygame.image.load("2.jpg") arect=a.get_rect() b=pygame.image.load("3.jpg") brect=b.get_rect() i=0 t=[0,0] clock=pygame.time.Clock() time=0 s=0 #主体 while True: clock.tick(60) screen.fill(color) #检测按键 for event in pygame.event.get(): if event.type==pygame.QUIT: sys.exit() if event.type==pygame.KEYDOWN: if not(arect.right>weight): if event.key==pygame.K_RIGHT: speed[0]=50 if not(arect.left<0): if event.key==pygame.K_LEFT: speed[0]=-50 if (arect.top>0): if event.key==pygame.K_UP: speed[1]=-50 if (arect.bottom<height): if event.key==pygame.K_DOWN: speed[1]=50

 
发布Blink于 2 月前

还有: if 球8.distance(玩家)<1: s=s+1 球8.hideturtle() 球8.goto(random.randint(-500,500),400) 球8.showturtle() #让球归位并积分 if 球1.ycor()<0:break if 球2.ycor()<0:break if 球3.ycor()<0:break if 球4.ycor()<0:break if 球5.ycor()<0:break if 球6.ycor()<0:break if 球7.ycor()<0:break if 球8.ycor()<0:break #探测没接住的球 print("游戏结束") print("分数",s)

 
发布Blink于 3 月前

最后部分: if 球1.distance(玩家)<1: 球1.hideturtle() 球1.goto(random.randint(-500,500),400) 球1.showturtle() s=s+1 if 球2.distance(玩家)<1: s=s+1 球2.hideturtle() 球2.goto(random.randint(-500,500),400) 球2.showturtle() if 球3.distance(玩家)<1: s=s+1 球3.hideturtle() 球3.goto(random.randint(-500,500),400) 球3.showturtle() if 球4.distance(玩家)<1: s=s+1 球4.hideturtle() 球4.goto(0,500) 球4.showturtle() if 球5.distance(玩家)<1: s=s+1 球5.hideturtle() 球5.goto(random.randint(-500,500),400) 球5.showturtle() if 球6.distance(玩家)<1: s=s+1 球6.hideturtle() 球6.goto(random.randint(-500,500),400) 球6.showturtle() if 球7.distance(玩家)<1: s=s+1 球7.hideturtle() 球7.goto(random.randint(-500,500),400) 球7.showturtle()

 
发布Blink于 3 月前

剩余部分: 球8.goto(random.randint(-500,500),400) #设立球的位和形状 s=0 turtle.onkeypress(left,"Left") turtle.onkeypress(right,"Right") 球1.setheading(270) 球2.setheading(270) 球3.setheading(270) 球4.setheading(270) 球5.setheading(270) 球6.setheading(270) 球7.setheading(270) 球8.setheading(270) turtle.listen() while True: 球1.forward(10) 球2.forward(10) 球3.forward(10) 球4.forward(10) 球5.forward(10) 球6.forward(10) 球7.forward(10) 球8.forward(10) #让球下落

 
发布Blink于 3 月前

import turtle import random t=turtle #缩写 t.register_shape("1.gif") t.register_shape("2.gif") #定义形状 玩家=t.Turtle() 玩家.shape("2.gif") 玩家.penup() #设立玩家形状 def left(): 玩家.setheading(180) 玩家.forward(10) def right(): 玩家.setheading(0) 玩家.forward(10) #设立玩家移动 球1=t.Turtle() 球1.shape("1.gif") 球1.penup() 球1.hideturtle() 球1.goto(random.randint(-500,500),400) 球2=t.Turtle() 球2.shape("1.gif") 球2.penup() 球2.hideturtle() 球2.goto(random.randint(-500,500),400) 球3=t.Turtle() 球3.shape("1.gif") 球3.penup() 球3.hideturtle() 球3.goto(random.randint(-500,500),400) 球4=t.Turtle() 球4.shape("1.gif") 球4.penup() 球4.hideturtle() 球4.goto(random.randint(-500,500),400) 球5=t.Turtle() 球5.shape("1.gif") 球5.penup() 球5.hideturtle() 球5.goto(random.randint(-500,500),400) 球6=t.Turtle() 球6.shape("1.gif") 球6.penup() 球6.hideturtle() 球6.goto(random.randint(-500,500),400) 球7=t.Turtle() 球7.shape("1.gif") 球7.penup() 球7.hideturtle() 球7.goto(random.randint(-500,500),400) 球8=t.Turtle() 球8.shape("1.gif") 球8.penup() 球8.hideturtle()

 
发布Blink于 3 月前

为什么总是自动地打开了shop.py

发布Blink于 4 月前