当前位置: 首页 > news >正文

有没有什么 网站能够做试卷推广普通话内容100字

有没有什么 网站能够做试卷,推广普通话内容100字,新浪微博做wordpress图床,娄底网站开发文章目录 游戏页面实现代码 游戏页面 左右键移动方块位置,上键切换方块形态。 实现代码 import pygame import random# 初始化 Pygame pygame.init()# 定义颜色 colors [(0, 0, 0), # 黑色(255, 0, 0), # 红色(0, 255, 0), # 绿色(0, 0, 255), # 蓝色(255,…

文章目录

  • 游戏页面
  • 实现代码

游戏页面

左右键移动方块位置,上键切换方块形态。
在这里插入图片描述

实现代码

import pygame
import random# 初始化 Pygame
pygame.init()# 定义颜色
colors = [(0, 0, 0),  # 黑色(255, 0, 0),  # 红色(0, 255, 0),  # 绿色(0, 0, 255),  # 蓝色(255, 255, 0),  # 黄色(255, 0, 255),  # 紫色(0, 255, 255)  # 青色
]# 俄罗斯方块形状
shapes = [[[1, 1, 1, 1]],[[1, 1],[1, 1]],[[0, 1, 1],[1, 1, 0]],[[1, 1, 0],[0, 1, 1]],[[1, 1, 1],[0, 1, 0]],[[1, 1, 1],[1, 0, 0]],[[1, 1, 1],[0, 0, 1]]
]# 设置游戏屏幕
screen_width = 300
screen_height = 600
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption('俄罗斯方块')# 游戏网格
grid = [[0 for _ in range(10)] for _ in range(20)]# 初始化时钟
clock = pygame.time.Clock()# 定义方块类
class Shape:def __init__(self):self.shape = random.choice(shapes)self.color = random.randint(1, len(colors) - 1)self.x = 3self.y = 0def rotate(self):self.shape = [list(row) for row in zip(*self.shape[::-1])]def draw(self):for i, row in enumerate(self.shape):for j, val in enumerate(row):if val:pygame.draw.rect(screen, colors[self.color], (self.x * 30 + j * 30, self.y * 30 + i * 30, 30, 30))def check_collision(shape):for i, row in enumerate(shape.shape):for j, val in enumerate(row):if val:if shape.x + j < 0 or shape.x + j >= 10 or shape.y + i >= 20 or grid[shape.y + i][shape.x + j]:return Truereturn Falsedef merge_shape(shape):for i, row in enumerate(shape.shape):for j, val in enumerate(row):if val:grid[shape.y + i][shape.x + j] = shape.colordef remove_full_lines():global gridgrid = [row for row in grid if not all(row)]while len(grid) < 20:grid.insert(0, [0 for _ in range(10)])def draw_grid():for y in range(20):for x in range(10):pygame.draw.rect(screen, colors[grid[y][x]], (x * 30, y * 30, 30, 30))def main():running = Truecurrent_shape = Shape()fall_time = 0while running:screen.fill((0, 0, 0))draw_grid()current_shape.draw()for event in pygame.event.get():if event.type == pygame.QUIT:running = Falseif event.type == pygame.KEYDOWN:if event.key == pygame.K_LEFT:current_shape.x -= 1if check_collision(current_shape):current_shape.x += 1if event.key == pygame.K_RIGHT:current_shape.x += 1if check_collision(current_shape):current_shape.x -= 1if event.key == pygame.K_DOWN:current_shape.y += 1if check_collision(current_shape):current_shape.y -= 1if event.key == pygame.K_UP:current_shape.rotate()if check_collision(current_shape):current_shape.rotate()current_shape.rotate()current_shape.rotate()fall_time += clock.get_rawtime()clock.tick()if fall_time / 1000 >= 0.5:fall_time = 0current_shape.y += 1if check_collision(current_shape):current_shape.y -= 1merge_shape(current_shape)remove_full_lines()current_shape = Shape()if check_collision(current_shape):running = Falsepygame.display.update()pygame.quit()if __name__ == "__main__":main()
http://www.ds6.com.cn/news/29424.html

相关文章:

  • 做淘口令网站图们网络推广
  • 向雅虎提交网站sem推广是什么意思呢
  • 自己组装电脑做网站服务器seo科技网
  • 做网站建设需要多少钱足球世界积分榜
  • 常州天宁区做网站公司微信运营工具
  • seo网站布局石家庄seo排名公司
  • 做网站放太多视频免费平台
  • php+mysql网站开发...百度网首页登录入口
  • 做模式网站重庆seo团队
  • 企业查询网站有哪些外贸建站优化
  • 怎么一键删除wordpress太原搜索引擎优化
  • 邢台网站建设免费做网站排名百度竞价推广托管
  • 商业网站建设实列百度网盘资源免费搜索引擎入口
  • 我想做个网站惠州短视频seo
  • wordpress导出软件seo范畴有哪些
  • 民治网站设计圳网站建设公司爱战网官网
  • 呼和浩特市做网站公司好的免费模板素材网站
  • 大一网页设计电商网站作业什么软件能搜索关键词能快速找到
  • 网站title是什么意思营销技巧有哪些
  • php视频网站怎么做网店推广是什么
  • 成都有哪些做网站开发的大公司seo优化6个实用技巧
  • 网页浏览器是windows系统自带的是seo培训网的优点是
  • 会展免费网站模板重庆百度seo
  • 公司营业执照可以做几个网站常州seo
  • 做网站多少钱一年推广员网站
  • 询盘网站嘉兴seo计费管理
  • 著名建筑网站中小企业管理培训班
  • 桑基图在线制作网站精准客户数据采集软件
  • 网站主色怎么选择怎么自己做网址
  • 梧州门户网站360竞价推广客服电话