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

南昌汉邦网站建设seo案例

南昌汉邦网站建设,seo案例,西宁做网站建设公司,网站建设金手指快速前言 下一个青年节快到了#xff0c;想小编我也是过不了几年节日了呢#xff01;#xff01; 社交媒体上流传着一张照片——按照国家规定“14岁到28岁今天都应该放半天假#xff01;”不得不说#xff0c; 这个跨度着实有点儿大#xff0c;如果按整自然年来算年龄想小编我也是过不了几年节日了呢 社交媒体上流传着一张照片——按照国家规定“14岁到28岁今天都应该放半天假”不得不说 这个跨度着实有点儿大如果按整自然年来算年龄心里还真是有点儿小激动呢 年纪大了喜欢回忆我逝去的青春了——不仅感叹一声自己果然已经老了~老了~老了~ 所有文章完整的素材源码都在 粉丝白嫖源码福利请移步至CSDN社区或文末公众hao即可免费。 直接摊牌吧 今天的小编给大家推文来安利童年“小游戏”的不过不是游戏内的小游戏。 而是Python代码编写的一些小游戏应该有很多童年的小伙伴儿都玩过很多小游戏吧。 现在可以重温童年时光咯~不仅感叹还是小时候的游戏有趣放开让我来都玩儿一遍儿吧~ 如果你能情不自禁的说出了大多数游戏的名字那么只能恭喜你暴露年龄啦~ 今天小编给大家带来两款童年的小游戏——我敢保证这两款童年小游戏你一定玩过 1坦克大战小游戏 单|双模式          2经典益智游戏推箱子 小科普—— 五四青年节源于中国1919年反帝爱国的“五四运动”五四爱国运动是一次彻底的反对帝国主义 和封建主义的爱国运动也是中国新民主主义革命的开始。1939年陕甘宁边区西北青年救国 联合会规定5月4日为中国青年节。 青年节期间中国各地都要举行丰富多彩的纪念活动青年们还要集中进行各种社会志愿和社 会实践活动还有许多地方在青年节期间举行成人仪式。 正文 一、素材准备 1环境准备  环境安装python 3.8: 解释器、pycharm: 代码编辑器、  相对应的安装包/安装教程/激活码/ 使用教程/学习资料/工具插件 可以直接找我厚台获取 。 自带的一些模块安装完Python可以直接使。如需要安装的话↓ 2模块安装教程 第三方库的安装方式如下  一般安装pip install 模块名 镜像源安装pip install -i https://pypi.douban.com/simple/模块名 还有很多国内镜像源这里是豆瓣的用习惯 了其他镜像源可以去看下之前文章都有写的 二、坦克大战小游戏 单|双模式 1游戏介绍 《坦克大战》是当年火遍大江南北的FC游戏小霸王时代的装机必备。现在看来是觉得画面有 点简陋但在以前绝对是属于玩不腻的游戏之一。 这游戏有一个奇葩特点就是可以自己打爆自己的碉堡车开的太猛得意忘形一炮把自己的老 家给爆了可以说是非常喜闻乐见了。 2代码展示 游戏有单人和双人两种模式己方大本营被破或者己方坦克被歼灭则游戏失败成功通过所有 关卡则游戏胜利。另外玩家可以通过射击特定的坦克使地图上随机出现一个道具若己方坦 克捡到该道具则触发一个事件例如坦克能力的增强。 代码效果—— 2.1玩家操作方式如下 玩家一 wsad键上下左右 空格键射击。 玩家二 ↑↓←→键上下左右 小键盘0键射击。 玩家一wsad键上下左右空格键射击。玩家二↑↓←→键上下左右小键盘0键射击。# 玩家一, WSAD移动, 空格键射击if tank_player1.num_lifes 0:if key_pressed[pygame.K_w]:player_tanks_group.remove(tank_player1)tank_player1.move(up, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player1)elif key_pressed[pygame.K_s]:player_tanks_group.remove(tank_player1)tank_player1.move(down, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player1)elif key_pressed[pygame.K_a]:player_tanks_group.remove(tank_player1)tank_player1.move(left, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player1)elif key_pressed[pygame.K_d]:player_tanks_group.remove(tank_player1)tank_player1.move(right, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player1)elif key_pressed[pygame.K_SPACE]:bullet tank_player1.shoot()if bullet:self.sounds[fire].play() if tank_player1.tanklevel 2 else self.sounds[Gunfire].play()player_bullets_group.add(bullet)# 玩家二, ↑↓←→移动, 小键盘0键射击if self.is_dual_mode and (tank_player2.num_lifes 0):if key_pressed[pygame.K_UP]:player_tanks_group.remove(tank_player2)tank_player2.move(up, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player2)elif key_pressed[pygame.K_DOWN]:player_tanks_group.remove(tank_player2)tank_player2.move(down, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player2)elif key_pressed[pygame.K_LEFT]:player_tanks_group.remove(tank_player2)tank_player2.move(left, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player2)elif key_pressed[pygame.K_RIGHT]:player_tanks_group.remove(tank_player2)tank_player2.move(right, self.scene_elems, player_tanks_group, enemy_tanks_group, home)player_tanks_group.add(tank_player2)elif key_pressed[pygame.K_KP0]:bullet tank_player2.shoot()if bullet:player_bullets_group.add(bullet)self.sounds[fire].play() if tank_player2.tanklevel 2 else self.sounds[Gunfire].play() 2.2主程序运行的代码 Function:经典坦克大战小游戏 import os import cfg import pygame from modules import *主函数 def main(cfg):# 游戏初始化pygame.init()pygame.mixer.init()screen pygame.display.set_mode((cfg.WIDTH, cfg.HEIGHT))pygame.display.set_caption(cfg.TITLE)# 加载游戏素材sounds {}for key, value in cfg.AUDIO_PATHS.items():sounds[key] pygame.mixer.Sound(value)sounds[key].set_volume(1)# 开始界面is_dual_mode gameStartInterface(screen, cfg)# 关卡数levelfilepaths [os.path.join(cfg.LEVELFILEDIR, filename) for filename in sorted(os.listdir(cfg.LEVELFILEDIR))]# 主循环for idx, levelfilepath in enumerate(levelfilepaths):switchLevelIterface(screen, cfg, idx1)game_level GameLevel(idx1, levelfilepath, sounds, is_dual_mode, cfg)is_win game_level.start(screen)if not is_win: breakis_quit_game gameEndIterface(screen, cfg, is_win)return is_quit_gamerun if __name__ __main__:while True:is_quit_game main(cfg)if is_quit_game:break 3效果展示 3.1游戏界面 3.2游戏加载画面 3.3游戏开始界面 三、经典益智游戏推箱子 1游戏介绍 《 推箱子 》的机制和玩法其实都很简单通过上下左右移动工人把箱子推到指定位置就行。 只不过它的游戏过程中牵涉到了大量的空间逻辑推理比如箱子推到角落就不能移动、不能同 时推两个箱子等等很容易陷入死局。 这种游戏设计和玩法的结合可玩性非常强于是这款游戏很快就火遍了全世界。 2代码展示 代码效果—— 2.1配置文件 配置文件 import os屏幕大小 SCREENSIZE (500, 500) block大小 BLOCKSIZE 50 levels所在文件夹 LEVELDIR os.path.join(os.getcwd(), resources/levels) 图片所在文件夹 IMAGESDIR os.path.join(os.getcwd(), resources/images) 字体所在文件夹 FONTDIR os.path.join(os.getcwd(), resources/font) 音频所在文件夹 AUDIODIR os.path.join(os.getcwd(), resources/audios) 背景颜色 BACKGROUNDCOLOR (45, 45, 45) 2.2运行主程序代码 Function:推箱子小游戏import os import sys import cfg import pygame from modules import * from itertools import chain游戏地图 class gameMap():def __init__(self, num_cols, num_rows):self.walls []self.boxes []self.targets []self.num_cols num_colsself.num_rows num_rows增加游戏元素def addElement(self, elem_type, col, row):if elem_type wall:self.walls.append(elementSprite(wall.png, col, row, cfg))elif elem_type box:self.boxes.append(elementSprite(box.png, col, row, cfg))elif elem_type target:self.targets.append(elementSprite(target.png, col, row, cfg))画游戏地图def draw(self, screen):for elem in self.elemsIter():elem.draw(screen)游戏元素迭代器def elemsIter(self):for elem in chain(self.targets, self.walls, self.boxes):yield elem该关卡中所有的箱子是否都在指定位置, 在的话就是通关了def levelCompleted(self):for box in self.boxes:is_match Falsefor target in self.targets:if box.col target.col and box.row target.row:is_match Truebreakif not is_match:return Falsereturn True某位置是否可到达def isValidPos(self, col, row):if col 0 and row 0 and col self.num_cols and row self.num_rows:block_size cfg.BLOCKSIZEtemp1 self.walls self.boxestemp2 pygame.Rect(col * block_size, row * block_size, block_size, block_size)return temp2.collidelist(temp1) -1else:return False获得某位置的boxdef getBox(self, col, row):for box in self.boxes:if box.col col and box.row row:return boxreturn None游戏界面 class gameInterface():def __init__(self, screen):self.screen screenself.levels_path cfg.LEVELDIRself.initGame()导入关卡地图def loadLevel(self, game_level):with open(os.path.join(self.levels_path, game_level), r) as f:lines f.readlines()# 游戏地图self.game_map gameMap(max([len(line) for line in lines]) - 1, len(lines))# 游戏surfaceheight cfg.BLOCKSIZE * self.game_map.num_rowswidth cfg.BLOCKSIZE * self.game_map.num_colsself.game_surface pygame.Surface((width, height))self.game_surface.fill(cfg.BACKGROUNDCOLOR)self.game_surface_blank self.game_surface.copy()for row, elems in enumerate(lines):for col, elem in enumerate(elems):if elem p:self.player pusherSprite(col, row, cfg)elif elem *:self.game_map.addElement(wall, col, row)elif elem #:self.game_map.addElement(box, col, row)elif elem o:self.game_map.addElement(target, col, row)游戏初始化def initGame(self):self.scroll_x 0self.scroll_y 0将游戏界面画出来def draw(self, *elems):self.scroll()self.game_surface.blit(self.game_surface_blank, dest(0, 0))for elem in elems:elem.draw(self.game_surface)self.screen.blit(self.game_surface, dest(self.scroll_x, self.scroll_y))因为游戏界面面积游戏窗口界面, 所以需要根据人物位置滚动def scroll(self):x, y self.player.rect.centerwidth self.game_surface.get_rect().wheight self.game_surface.get_rect().hif (x cfg.SCREENSIZE[0] // 2) cfg.SCREENSIZE[0]:if -1 * self.scroll_x cfg.SCREENSIZE[0] width:self.scroll_x - 2elif (x cfg.SCREENSIZE[0] // 2) 0:if self.scroll_x 0:self.scroll_x 2if (y cfg.SCREENSIZE[1] // 2) cfg.SCREENSIZE[1]:if -1 * self.scroll_y cfg.SCREENSIZE[1] height:self.scroll_y - 2elif (y 250) 0:if self.scroll_y 0:self.scroll_y 2某一关卡的游戏主循环 def runGame(screen, game_level):clock pygame.time.Clock()game_interface gameInterface(screen)game_interface.loadLevel(game_level)font_path os.path.join(cfg.FONTDIR, simkai.ttf)text 按R键重新开始本关font pygame.font.Font(font_path, 15)text_render font.render(text, 1, (255, 255, 255))while True:for event in pygame.event.get():if event.type pygame.QUIT:pygame.quit()sys.exit(0)elif event.type pygame.KEYDOWN:if event.key pygame.K_LEFT:next_pos game_interface.player.move(left, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(left)else:box game_interface.game_map.getBox(*next_pos)if box:next_pos box.move(left, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(left)box.move(left)breakif event.key pygame.K_RIGHT:next_pos game_interface.player.move(right, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(right)else:box game_interface.game_map.getBox(*next_pos)if box:next_pos box.move(right, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(right)box.move(right)breakif event.key pygame.K_DOWN:next_pos game_interface.player.move(down, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(down)else:box game_interface.game_map.getBox(*next_pos)if box:next_pos box.move(down, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(down)box.move(down)breakif event.key pygame.K_UP:next_pos game_interface.player.move(up, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(up)else:box game_interface.game_map.getBox(*next_pos)if box:next_pos box.move(up, is_testTrue)if game_interface.game_map.isValidPos(*next_pos):game_interface.player.move(up)box.move(up)breakif event.key pygame.K_r:game_interface.initGame()game_interface.loadLevel(game_level)game_interface.draw(game_interface.player, game_interface.game_map)if game_interface.game_map.levelCompleted():returnscreen.blit(text_render, (5, 5))pygame.display.flip()clock.tick(100)主函数 def main():pygame.init()pygame.mixer.init()pygame.display.set_caption(推箱子 —— 源码基地#959755565#)screen pygame.display.set_mode(cfg.SCREENSIZE)pygame.mixer.init()audio_path os.path.join(cfg.AUDIODIR, EineLiebe.mp3)pygame.mixer.music.load(audio_path)pygame.mixer.music.set_volume(0.4)pygame.mixer.music.play(-1)startInterface(screen, cfg)for level_name in sorted(os.listdir(cfg.LEVELDIR)):runGame(screen, level_name)switchInterface(screen, cfg)endInterface(screen, cfg)run if __name__ __main__:main() 3效果展示 3.1游戏界面 3.2第二关游戏界面 总结 好啦~今天的内容就更新到这里先给大家介绍2款童年的小游戏吧如果你喜欢这个游戏滴滴  我免费分享的哈你的童年还玩儿过那些游戏呢偷偷收藏起来以后可以写成代码的哦~ ✨完整的素材源码等可以滴滴我吖或者点击文末hao自取免费拿的哈~ 推荐往期文章—— 项目0.9  【Python实战】WIFI密码小工具甩万能钥匙十条街WIFI任意连哦~附源码 项目1.0  【Python实战】再分享一款商品秒杀小工具我已经把压箱底的宝贝拿出来啦~ 项目0.1  宝藏拼图神秘上线三种玩法刷爆朋友圈—玩家直呼太上瘾了。 项目0.2 【Pygame小游戏】Python版有迷宫嘛原来藏在个地方呀~ 项目0.6 【Python实战项目】做一个 刮刮乐 案例一不小心....着实惊艳到我了。 项目0.7  升级版飞机大战来袭手把手教学万字详解你还学不会嘛 文章汇总—— Python文章合集 | (入门到实战、游戏、Turtle、案例等) 文章汇总还有更多你案例等你来学习啦~源码找我即可免费
http://www.dnsts.com.cn/news/3014.html

相关文章:

  • 仿网站建设教程视频厦门百度seo
  • 网站优化qq群网建公司
  • 线上销售平台如何推广成都自动seo
  • 怎么做网站广告卖钱上海seo优化外包公司
  • 万网ecs网站环境搭建全网营销式网站
  • 专门做网站的公司与外包公司海外发布新闻
  • 网站维护 内容软文网站推广
  • 怎么样在网站上做跳转360seo排名点击软件
  • 域名做网站腾讯企业qq官网
  • 网站建设改版西安危机公关公司
  • 义乌国际贸易综合信息服务平台清理优化大师
  • 旅行网站开发意义网络黄页推广软件哪个好
  • 门户网站开发流程小程序开发需要哪些技术
  • 科技网站推荐营销方案怎么写
  • 网站建设费用计算常用的搜索引擎有
  • 做网站主要来源seo是什么意思为什么要做seo
  • 怎么给网站添加黑名单地推平台去哪里找
  • 做网购的有哪几个网站竞价推广sem
  • 专做外贸的网站二级子域名ip地址查询
  • 杭州做网站公司百度搜索关键词排名人工优化
  • 做网站公司在哪企业管理培训班
  • 国外自建站怎么样西安网络推广外包公司
  • b2c网站怎么做seo培训班 有用吗
  • 海口模板建站平台ui设计
  • 做贷款行业哪些网站能发布广告关键字优化
  • 霸县网站建设郑州百度搜索优化
  • 这个网站中有网名做会计的吗 了解一下搜狗网页搜索
  • 网站建设推广关键词百度联盟项目看广告挣钱
  • 河北建设工程信息网官方网站天津关键词排名提升
  • calypso wordpress企业网站设计优化公司