猫史档案馆


伦敦西区肯辛顿富人区名富商大天才煊

伦敦西区肯辛顿富人区名富商大天才煊

Lv.1

努力像我昵称一样名商人。帝国崛起、技术大爆炸、努力做生意

获赞:1414收藏:755浏览:64170作品收藏:1301

签名:做作品和做生意 联系方式:QQ:430460845

回复帖子评论
上一页2 页 / 共 35下一页

【招人】未来工作室 中回复

https://shequ.codemao.cn/community/169060

2019-02-16T12:58:00 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

有人吗

2019-02-16T12:58:59 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

告诉了你们也不懂

2019-02-16T12:59:28 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

顶一个

2019-02-16T13:16:39 点赞:0

【招人】未来工作室 中回复

申请格式https://www.codemao.cn/community/168喵9

2019-02-16T13:21:26 点赞:0

谁会做Python贪吃蛇游戏。 中回复

import pygame, random
from pygame.locals import *
pygame.init()

UNITSIZE = 50
WINWUNITS = 8
WINHUNITS = 8

WINW = UNITSIZE * WINWUNITS
WINH = UNITSIZE * WINHUNITS

FPS = 2
CLOCK = pygame.time.Clock()

snake = [(3, 3), (2, 3) , (1, 3)]
direction = "right"
score = 0

BGCOLOR = GOLD = (216, 234, 196)
HEADC = BLUE = ( 0, 0, 255)
SNAKEC = RED = (255, 0, 0)
STARC = YELLOW = (255, 255, 0)

SCREEN = pygame.display.set_mode((WINW, WINH))
pygame.display.set_caption("贪吃的小蛇 - 得分:0")

def updateStar():
global star
validPos = []
for x in range(WINWUNITS):
for y in range(WINHUNITS):
validPos.append((x, y))
for invalid in snake:
validPos.remove(invalid)
star = random.choice(validPos)

def unit2rect(units):
return pygame.Rect(units[0] * UNITSIZE, units[1] * UNITSIZE, UNITSIZE, UNITSIZE)

def drawSnake(screen, headc, bodyc, poseslist, radius):
for pos in snake:
if pos == snake[0]:
color = headc
else:
color = bodyc
unitr = unit2rect(pos)
pygame.draw.circle(screen, color, unitr.center, radius)

def drawStar(screen, color, rect):
l = rect.left
w = rect.width
t = rect.top
h = rect.height
pygame.draw.polygon(screen, color, ((l + 0.5 * w, t ),
(l + 0.6 * w, t + 0.4 * h),
(l + w, t + 0.4 * h),
(l + 0.7 * w, t + 0.6 * h),
(l + 0.8 * w, t + h),
(l + 0.5 * w, t + 0.8 * h),
(l + 0.2 * w, t + h),
(l + 0.3 * w, t + 0.6 * h),
(l , t + 0.4 * h),
(l + 0.4 * w, t + 0.4 * h)))

updateStar()

while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
exit()
elif event.type == KEYDOWN:
if event.key == K_LEFT and direction != "right":
direction = "left"
elif event.key == K_RIGHT and direction != "left":
direction = "right"
elif event.key == K_UP and direction != "down":
direction = "up"
elif event.key == K_DOWN and direction != "up":
direction = "down"

SCREEN.fill(BGCOLOR)

if direction == "left":
snake.insert(0, ((snake[0][0]-1) % WINWUNITS, snake[0][1]))
elif direction == "right":
snake.insert(0, ((snake[0][0]+1) % WINWUNITS, snake[0][1]))
elif direction == "up":
snake.insert(0, (snake[0][0], (snake[0][1]-1) % WINHUNITS))
elif direction == "down":
snake.insert(0, (snake[0][0], (snake[0][1]+1) % WINHUNITS))

drawSnake(SCREEN, HEADC, SNAKEC, snake, UNITSIZE//2)
drawStar(SCREEN, STARC, pygame.Rect(unit2rect(star)))

if snake[0] == star:
score += 1
updateStar()
pygame.display.set_caption("贪吃的小蛇 - 得分:" + str(score))
elif snake[0] in snake[1:]:
pygame.display.update()
pygame.time.wait(3000)
print('最终得分',score,'分')
pygame.quit()
exit()

else:
snake.pop()


pygame.display.update()
CLOCK.tick(FPS)

2019-02-16T14:26:08 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

有人吗

2019-02-16T20:45:57 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

告诉你们吧,有外星人基地

2019-02-16T20:46:28 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

你们找不到

2019-02-16T20:46:38 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

https://ide.codemao.cn/we/6766411

2019-02-16T20:55:08 点赞:0

【号外!号外!】我的作品里有大秘密 中回复

入口就在第一页

2019-02-17T15:28:29 点赞:0

【修图店】【封面店】 中回复

封面格式:

必填:

大字:

【开源】做生意(跑商)

小字:快来玩吧

非必填:

底图:

center_image

风格:富有

要求:很像做生意的风格

2019-02-18T12:18:29 点赞:0

【修图店】【封面店】 中回复

2019-02-18T12:22:29 点赞:0

【聊聊梦想】满五人,我开个人梦想讲座 中回复

你们好

2019-02-18T12:25:40 点赞:0

【聊聊梦想】满五人,我开个人梦想讲座 中回复

没看懂你们在干嘛

2019-02-18T12:25:55 点赞:0

谁能帮我完成半成品(版权给他) 中回复

作品呢

2019-02-18T20:08:23 点赞:0

【编程小店】总店开张啦~~~ 中回复

喵?

2019-02-18T20:10:30 点赞:0

【编程小店】总店开张啦~~~ 中回复

无偿服务的话

2019-02-18T20:10:40 点赞:0

【编程小店】总店开张啦~~~ 中回复

店员有什么待遇吗

2019-02-18T20:10:50 点赞:0

【店铺】名片店铺 中回复

我要订

2019-02-18T20:13:37 点赞:0

【店铺】名片店铺 中回复

How much

2019-02-18T20:13:50 点赞:0

【封面店铺】 中回复

要游戏封面

2019-02-18T20:20:02 点赞:0

【小教程】如何限制网站访问 中回复

print('奶茶是专攻C++的?)
answer=input('能看懂吗?')
if answer=='能':
    print('1')
else:
    print('1')

2019-02-18T20:23:37 点赞:0

【封面店铺】 中回复

奶茶?

2019-02-19T10:28:35 点赞:0

【你有没有喜欢的异性?】 中回复

emotion_编程猫_冷漠

2019-02-19T10:33:14 点赞:0

【诧异】我的作品 中回复

真的

2019-02-19T13:34:56 点赞:0

奥古斯塔银行是什么? 中回复

我要喵

2019-02-19T13:51:21 点赞:0

【往事回顾】编程猫历史:你见过几个? 中回复

源码编辑器我无法输入代码

2019-02-19T13:52:23 点赞:0

【往事回顾】编程猫历史:你见过几个? 中回复

以前好像还开过工作室,为什么以前取消了?为什么银行没了?(希望可以喵)为什么战队没了?

这些东西都挺好的

2019-02-19T13:54:44 点赞:0

【奥古斯塔银行】停业整顿通知 中回复

我要喵!!!!10万!

2019-02-19T13:57:24 点赞:0