
Lv.1
没啥的
签名:没事出一堆水作
在 【Python作品分享】Hatefulball Pong 2.0【作品秀】 中回复
import pygame as p
import time as t
p.init()
s = p.display.set_mode([800,600])
p.display.set_caption("----- Smiley Pong 2.0 -----")
k = True
BLACK = (0,0,0)
WHITE = (255,255,255)
YELLOW = (255,255,0)
ix = 60
iy = 60
speedx = 1
speedy = 1
pw = 200
ph = 25
px = 300
py = 550
iw = 100
ih = 100
po = 0
l = 5
r = 50
o = 0
ti = 0.01
font = p.font.SysFont("Times",24)
while k:
for event in p.event.get():
if event.type == p.QUIT:
k = False
if event.type == p.KEYDOWN:
if event.key == p.K_F1:
po = 0
l = 5
ix = 60
iy = 60
speedx = 1
speedy = 1
if event.key == p.K_F2:
ti = 0.01
ix += speedx
iy += speedy
if ix <= 50 or ix >= 750:
speedx = -speedx
if iy <= 50:
speedy = -speedy
if iy >= 550:
l -= 1
speedy = -1
speedx = 1
iy = 549
s.fill(BLACK)
p.draw.circle(s,YELLOW,(ix,iy),r)
px = p.mouse.get_pos()[0]
px -= pw/2
p.draw.rect(s, WHITE, (px, py, pw, ph))
ti -= 0.000001
if ti > 0.001:
t.sleep(ti)
else:
t.sleep(0.001)
if iy + ih - 50 >= py and iy + ih - 50 <= py + ph and speedy > 0:
if ix + iw/2 - 50 >= px and ix + iw/2 - 50 <= px + pw:
speedy = -speedy
po += 1
draw_string = "Lives:" + str(l) + " Points: " + str(po) + " Press [F2] to turn the speed to 0.01.(Press [Fn] first)"
if l < 1:
speedx = 0
speedy = 0
draw_string = "...Game Over..."
draw_string += "Your score was: " + str(po)
draw_string += ". Press [F1] to play again. "
text = font.render((draw_string), True, WHITE)
text_rect = text.get_rect()
text_rect.centerx = s.get_rect().centerx
text_rect.y = 10
s.blit(text,text_rect)
p.display.update()
p.quit()2020-10-05T15:15:38 点赞:0
在 【kitten4.0反馈】遇到问题不要怕,技术喵来帮你忙! 中回复
点开始不动。https://kitten4.codemao.cn/#70喵5867
2020-12-06T15:39:53 点赞:0
在 让我康康猫站有多少人知道undertale和au? 中回复
sans和帕派瑞斯的曲子叫狂妄之人和骨头狂潮。sans的审判眼在我们的视角是右眼。决心鱼全名叫不灭的安黛因。mtt全名叫镁塔顿。ink!sans的au叫--tale。到底蓝莓是哥还是烟枪是弟。反转传说是frisk流石油。
2020-12-26T18:43:57 点赞:1
在 论室长和 y k s 夜 晚 的 星 星 的年龄和性别 中回复
░░░░░▄▄▀▀▀▀▀▀▀▀▀▄▄░░░░░
░░░░█░░░░░░░░░░░░░█░░░░
░░░░█░░░░░░░░░█░░░█░░░░
░░░░█░░░░░░░░█▄▄▄░░░█░░░
░░░░█░▄▄▄░░▄░████░░░░█░░░
░░░▄█░▄░░░▀▀▀░░░▄░░░░▄░░░
░░░█░░▀█▀█▀█▀█▀█▀░░█░░░
░░░▄██▄▄▀▀▀▀▀▀▀▄▄██▄░░░
░▄█░█▀▀█▀▀▀█▀▀▀█▀▀█░█▄░
▄▀░▄▄▀▄▄▀▀▀▄▀▀▀▄▄▀▄▄░▀▄
█░░░░▀▄░█▄░░░▄█░▄▀░░░░█
░▀▄▄░█░░█▄▄▄▄▄█░░█░▄▄▀░
░░░▀██▄▄███████▄▄██▀░░░
想来一个不好的汤姆吗?
2021-01-16T20:32:56 点赞:0