猫史档案馆


無一郎

無一郎

Lv.1

别看了啥也没有

获赞:10收藏:5浏览:70作品收藏:0
回复帖子评论
上一页1 页 / 共 2下一页

【Python作品分享】素描制作机器【教程贴】 中回复

早就学完了

 

2020-03-07T13:15:43 点赞:0

外星人入侵————教程 中回复

我想学

 

2020-03-11T12:58:33 点赞:0

揭秘SGS佐助哥哥的???? 中回复

已举报不谢

 

2020-03-14T13:42:42 点赞:0

【海龟编辑器】意见反馈信箱(长期有效) 中回复

我怎么安装完了,所有安装的库都没了emotion_编程猫_紧张

2020-03-17T16:12:13 点赞:0

【新版本发布!】海龟编辑器客户端-V1.3.2 中回复

我安装完了,所有安装的库都没了emotion_编程猫_紧张

2020-03-17T16:15:27 点赞:0

【Python作品分享】木马病毒检测器【作品秀】 中回复

我以为是真的

emotion_编程猫_搓头

2020-03-25T13:07:10 点赞:0

【Python作品分享】贪吃蛇【作品秀】 中回复

我帮你改良了一下

 

# encoding: utf-8 import pygame import sys import random import sys from PySide2.QtWidgets import *
app = QApplication(sys.argv)
window = QMainWindow()
QMessageBox.information(window,"贪吃蛇游戏官方","请确定您是否要玩此游戏",QMessageBox.Yes,QMessageBox.No)
# 全局定义 SCREEN_X = 600 SCREEN_Y = 600

# 蛇类 # 点以25为单位 class Snake(object): # 初始化各种需要的属性 [开始时默认向右/身体块x5] def__init__(self): self.dirction = pygame.K_RIGHT self.body = [] for x inrange(5): self.addnode()
# 无论何时 都在前端增加蛇块 def addnode(self): left, top = (0, 0) if self.body: left, top = (self.body[0].left, self.body[0].top) node = pygame.Rect(left, top, 25, 25) if self.dirction == pygame.K_LEFT: node.left -= 25 elif self.dirction == pygame.K_RIGHT: node.left += 25 elif self.dirction == pygame.K_UP: node.top -= 25 elif self.dirction == pygame.K_DOWN: node.top += 25 self.body.insert(0, node)
# 删除最后一个块 def delnode(self): self.body.pop()
# 死亡判断 def isdead(self): # 撞墙 if self.body[0].x notinrange(SCREEN_X): returnTrue if self.body[0].y notinrange(SCREEN_Y): returnTrue # 撞自己 if self.body[0]in self.body[1:]: returnTrue returnFalse
# 移动! def move(self): self.addnode() self.delnode()
# 改变方向 但是左右、上下不能被逆向改变 def changedirection(self, curkey): LR = [pygame.K_LEFT, pygame.K_RIGHT] UD = [pygame.K_UP, pygame.K_DOWN] if curkey in LR+UD: if(curkey in LR)and(self.dirction in LR): return if(curkey in UD)and(self.dirction in UD): return self.dirction = curkey

# 食物类 # 方法: 放置/移除 # 点以25为单位 class Food: def__init__(self): self.rect = pygame.Rect(-25, 0, 25, 25)
def remove(self): self.rect.x = -25
defset(self): if self.rect.x == -25: allpos = [] # 不靠墙太近 25 ~ SCREEN_X-25 之间 for pos inrange(25, SCREEN_X-25,25): allpos.append(pos) self.rect.left = random.choice(allpos) self.rect.top = random.choice(allpos) print(self.rect)

def show_text(screen, pos, text, color, font_bold=False, font_size=60, font_italic=False): #获取系统字体,并设置文字大小 cur_font = pygame.font.SysFont("宋体", font_size) #设置是否加粗属性 cur_font.set_bold(font_bold) #设置是否斜体属性 cur_font.set_italic(font_italic) #设置文字内容 text_fmt = cur_font.render(text, 1, color) #绘制文字 screen.blit(text_fmt, pos)

def main(): pygame.init() screen_size = (SCREEN_X, SCREEN_Y) screen = pygame.display.set_mode(screen_size) pygame.display.set_caption('Snake') clock = pygame.time.Clock() scores = 0 isdead = False
# 蛇/食物 snake = Snake() food = Food()
whileTrue: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == pygame.KEYDOWN: snake.changedirection(event.key) # 死后按space重新 if event.key == pygame.K_SPACE and isdead: return main()
screen.fill((255, 255, 255))
# 画蛇身 / 每一步+1分 ifnot isdead: scores += 1 snake.move() for rect in snake.body: pygame.draw.rect(screen, (20, 220, 39), rect, 0)
# 显示死亡文字 isdead = snake.isdead() if isdead: show_text(screen, (100, 200), 'YOU DEAD!', (227,29,18),False,100) show_text(screen, (150, 260), 'press space to try again...',(0,0,22),False,30)
# 食物处理 / 吃到+50分 # 当食物rect与蛇头重合,吃掉 -> Snake增加一个Node if food.rect == snake.body[0]: scores += 50 food.remove() snake.addnode()
# 食物投递 food.set() pygame.draw.rect(screen, (136, 0, 21), food.rect, 0)
# 显示分数文字 show_text(screen, (50, 500), 'Scores: '+str(scores), (223, 223, 223))
pygame.display.update() clock.tick(10)

if __name__ == '__main__': main()

2020-03-26T11:06:03 点赞:0

【钉钉奇葩使用教学】 中回复

只能在钉钉里用吗

 

2020-03-28T13:39:51 点赞:0

【pygame:飞机大战】教你用pygame开发游戏 Part8 中回复

emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞

2020-03-30T19:11:56 点赞:0

炫酷的闪屏 中回复

import turtle import time

def func(time_, time__):
for __count inrange(time__): turtle.bgcolor("#ff0000") time.sleep(time_ / 100000000) turtle.bgcolor("#ff6600") time.sleep(time_ / 100000000) turtle.bgcolor("#ffff00") time.sleep(time_ / 100000000) turtle.bgcolor("#00ff00") time.sleep(time_ / 100000000) turtle.bgcolor("#00cccc") time.sleep(time_ / 100000000) turtle.bgcolor("#3333ff") time.sleep(time_ / 100000000) turtle.bgcolor("#6633ff") time.sleep(time_ / 100000000)

func(0,喵000000000000000000000000000000000000000000000000)   我帮你改良了一下,能把人的眼镜闪瞎

2020-03-30T23:42:18 点赞:0

【Python作品分享】黑客帝国代码雨【作品秀】 中回复

emotion_编程猫_厉害了

2020-03-31T12:52:41 点赞:0

【Python作品分享】cmd 中回复

看不懂

2020-03-31T12:57:50 点赞:0

【Python作品分享】新的作品【作品秀】 中回复

emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_厉害了emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞

2020-03-31T23:01:53 点赞:2

[我叫以赏]Python获取笔趣阁文章 中回复

emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞

2020-04-01T16:01:08 点赞:0

【Python作品分享】123312121 中回复

emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠

2020-04-02T16:45:34 点赞:0

【内测编辑器】可以高亮,缩进,的python编辑器! 中回复

邮箱 1879031086@qq.com

2020-04-02T19:04:28 点赞:0

【Python作品分享】进制转换v2.4 中回复

emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞emotion_编程猫_点赞

2020-04-02T19:05:43 点赞:1

【Python作品分享】管喵【作业帖】 中回复

emotion_编程猫_冷漠emotion_编程猫_冷漠

2020-04-02T19:09:57 点赞:0

【区分】文本编辑器和编译器的区别 中回复

emotion_编程猫_点赞

2020-04-02T21:14:14 点赞:0

【用python做一个ide】第一部分:设计编辑器最基础UI 中回复

 

期待下次的教程

2020-04-04T16:50:15 点赞:0

【Python作品分享】pygame实现雨滴下落背景动画特效【作品秀】 中回复

emotion_编程猫_点赞

2020-04-06T19:56:23 点赞:0

有懂Python的成员吗,帮个忙 中回复

可以

2020-04-07T08:50:33 点赞:0

如何用python播放音乐 中回复

emotion_编程猫_点赞

2020-04-07T09:45:39 点赞:2

申请加入工作室 中回复

https://shequ.codemao.cn/user/3564022

2020-04-07T10:52:17 点赞:0

【Python作品分享】让你的电脑疯狂吧!【作品秀】 中回复

emotion_编程猫_冷漠

2020-04-07T11:11:44 点赞:0

Python五种控制台加载动画 中回复

emotion_编程猫_点赞

2020-04-08T19:49:04 点赞:0

Python-如何救起落水帅哥☺ 中回复

emotion_编程猫_冷漠

2020-04-08T19:51:56 点赞:2

处理图像滤镜软件,新增剪裁头像,设为QQ头像功能 中回复

自顶

我顶

2020-04-24T13:06:06 点赞:0

【Python作品分享】星辰翻译机【作品秀】 中回复

完整作品链接:https://pan.baidu.com/s/1y17ZC9dCHrM7edgggwXwzA
提取码:s8nl

2020-04-28T19:44:55 点赞:0

【Python作品分享】Windows电脑关机 中回复

坑人也得认真点

2020-05-01T00:13:15 点赞:0