Commit 977cc2da by BellCodeEditor

auto save

parent 3ff190ba
for i in range(10): import pygame
print("悟空") form pygame import locale
\ No newline at end of file pyagme.init()
screen=pygame.display.set_mode((660,480))
FPSCLOCK=pygame.time.Clock()
background=pyagme.image.load("bg.png")
food=pygame.image.load("apple.png")
while True:
for event in pygame.event.get():
if event.type==locals.QUIT:
exit()
screen.blit(bakcground,(0,0))
screen.blit(food.(0.0))
pygame.display.update()
FPSCLOCK.tick(3)
\ No newline at end of file
询问玩家出拳 /input()
显示玩家出拳结果 /print()
建立列表 list
导入随机模块 import
choice方法 随机机器机出拳 random
显示计算机出拳结果 print
比较猜拳结果 and or
if判断输入内容是否正确if player in list:
if
elif (player=="石头" and computer=="剪刀") or
else
else不正确输入错误
\ No newline at end of file
player=input("请出拳:石头/剪刀/布")
print("玩家出拳:"+player)
#导入 RANDOM
import random
#创建列表
list=["石头","剪刀","布"]
#choice方法选择列表中的一个元素
computer=random.choice(list)
#打印出计算机出拳computer
print("计算机出拳:"+comouter)
if player in list:
if computer==player
print("平局")
elif (player=="石头" and computer=="剪刀") or (player=="剪刀" and computer=="布") or (player=="布" and computer=="石头") :
print("玩家赢")
else:
print("计算机赢")
else:
print("输入错误")
import random #导入随机模块
list=['石头','剪刀','布']
computer=random.choice(list)
# input 输入 print 输出
#计算机
for i in range(3):
player=input('请出拳(石头/剪刀/布)')
print("玩家出拳:"+player)
print("计算机出拳:"+computer)
if i in list:
if player==computer:
print("平局")
elif player="石头" and computer="剪刀" or : #else if
print("玩家胜利")
else
print("计算机胜利")
else:
print('输入错误,请重新输入')
a=2
b=3
print(a*b)
\ No newline at end of file
怪物2
初始化坐标 goto(x,y)
面向setheading(45)
循环while True:
移动 forward(10)
碰到舞台边缘就反弹 rebound()
下一个造型nextcostume
如果碰到小贝if istouching("小贝")
游戏失败game_staus="lose"
\ No newline at end of file
last.png

3.79 KB

import pygame
from pygame import locals
pygame.init() # 初始化
# 创建窗口
screen = pygame.display.set_mode((640, 480))
# 载入图片
bg_img = pygame.image.load('background.png') # 背景图
play_img = pygame.image.load('play.png') # 播放按钮
stop_img = pygame.image.load('stop.png') # 暂停按钮
last_img = pygame.image.load('last.png') # 上一曲按钮
next_img = pygame.image.load('next.png') # 下一曲按钮
logo_img = pygame.image.load('logo.png') # 中间logo
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
exit()
if
# 绘制画面
screen.blit(bg_img, (0, 0)) # 填充背景
screen.blit(play_button, (270, 330)) # 暂停按钮
screen.blit(logo_img, (170, 60)) # 中间logo图
screen.blit(last_img, (120, 350)) # 上一曲
screen.blit(next_img, (420, 350)) # 下一曲
# 刷新画面
pygame.display.update()
logo.png

40.9 KB

File added
next.png

3.87 KB

play.png

12.1 KB

# 导入画笔
screen=turtle.Screen()
screen.bgcolor("red")``
# 创建画笔
# turtle.write() 写入内容。‘’,font=("Times",20,"normal")
# 隐藏画笔
# 保存画布
# import turtle
# pen=turtle.Pen()
# pen.write("好人一生好,\n 谁来问春秋。\n斜阳射水中,\n傻人有傻福",font=("Times",20,"normal"))
# pen.hideturtle()
# turtle.done()
len=screen.textinput("提示","你要多大爱心!")
xin=int(len)
pen1=turtle.Pen()
pen1.left(45)
pen1.forward(2*xin)
pen1.circle(xin,180)
pen1.right(90)
pen1.circle(xin,180)
pen1.forward(2*xin)
pen1.hideturtle()
turtle.done()
\ No newline at end of file
# 上节课你是这样绘制的五角星👇: today=input("今天是星期几")
# 这节课你可以利用新学的知识自定义五角星的颜色么? if today=="星期一":
import turtle print("今天学钢琴")
ink = input("什么色?")#绘制五角星# if today=="星期三":
pen = turtle.Pen() print("今天学编程")
pen.fillcolor(ink) if today=="星期六":
pen.begin_fill() print("今天学英语")
for i in range(6): #重复执行5次 else:
pen.forward(100) #向前移动200步 print("今天学国学")
pen.right(60) #向右移动144度,注意这里的参数一定不能变 \ No newline at end of file
pen.end_fill() #结束填充红色
turtle.done()
stop.png

11.6 KB

File added
File added
File added
File added
File added
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