猫史档案馆


7654Fox

7654Fox

Lv.1

我是傻__

获赞:68收藏:11浏览:1264作品收藏:1

签名:你猜

回复帖子评论
上一页1 页 / 共 4下一页

【源码勇士-招募令】 中回复

请问Python普及课算吗?

2020-05-13T08:52:05 点赞:0

【手机编程】口袋里的编程神器,随时随地创造世界! 中回复

我不喜欢手机,我又不是低头族。emotion_编程猫_冷漠还是用电脑吧。

2020-05-15T15:31:49 点赞:1

社区星评选规则更新 中回复

我如果选上了,就不玩电脑了。

2020-05-20T19:45:43 点赞:0

(获奖名单见评论区置顶)【六一活动】经典怀旧创作,参与100%有奖 中回复

emotion_编程猫_加油emotion_编程猫_加油emotion_编程猫_加油可以香肠派对吗?

俄罗斯方块也不错啊。

2020-05-23T10:01:51 点赞:0

Nemo3.0即将上线!超多作品推荐位等你抢占!投稿还有丰富周边奖品~~ 中回复

看到这是什么了吗?????????????????????

center_image

# SmileyPong1.py
import pygame       # Setup
pygame.init()
screen = pygame.display.set_mode([800,600])
pygame.display.set_caption("Smiley Pong")
keepGoing = True
pic = pygame.image.load("CrazySmile.bmp")
colorkey = pic.get_at((0,0))
pic.set_colorkey(colorkey)
picx = 0
picy = 0
BLACK = (0,0,0)
WHITE = (255,255,255)
timer = pygame.time.Clock()
speedx = 5
speedy = 5
paddlew = 200
paddleh = 25
paddlex = 300
paddley = 550
picw = 100
pich = 100
points = 0
lives = 5
font = pygame.font.SysFont("Times", 24)
while keepGoing:    # Game loop
    for event in pygame.event.get(): 
        if event.type == pygame.QUIT: 
            keepGoing = False
    picx += speedx
    picy += speedy
    
    if picx <= 0 or picx + pic.get_width() >= 800:
        speedx = -speedx
    if picy <= 0:
        speedy = -speedy 
    if picy >= 500:
        lives -= 1
        speedy = -speedy
    screen.fill(BLACK)    
    screen.blit(pic, (picx, picy))
    # Draw paddle
    paddlex = pygame.mouse.get_pos()[0]
    paddlex -= paddlew/2
    pygame.draw.rect(screen, WHITE, (paddlex, paddley, paddlew, paddleh))
    # Check for paddle bounce
    if picy + pich >= paddley and picy + pich <= paddley + paddleh \
       and speedy > 0:
        if picx + picw / 2 >= paddlex and picx + picw / 2 <= paddlex + \
           paddlew:
            points += 1
            speedy = -speedy
    # Draw text on screen
    draw_string = "Lives: " + str(lives) + " Points: " + str(points)
        
    text = font.render(draw_string, True, WHITE)
    text_rect = text.get_rect()
    text_rect.centerx = screen.get_rect().centerx
    text_rect.y = 10
    screen.blit(text, text_rect)
    pygame.display.update()
    timer.tick(60)
    
pygame.quit()       # Exit



# SmileyPong2.py
import pygame       # Setup
pygame.init()
screen = pygame.display.set_mode([800,600])
pygame.display.set_caption("Smiley Pong")
keepGoing = True
pic = pygame.image.load("CrazySmile.bmp")
colorkey = pic.get_at((0,0))
pic.set_colorkey(colorkey)
picx = 0
picy = 0
BLACK = (0,0,0)
WHITE = (255,255,255)
timer = pygame.time.Clock()
speedx = 5
speedy = 5
paddlew = 200
paddleh = 25
paddlex = 300
paddley = 550
picw = 100
pich = 100
points = 0
lives = 5
font = pygame.font.SysFont("Times", 24)
while keepGoing:    # Game loop
    for event in pygame.event.get(): 
        if event.type == pygame.QUIT: 
            keepGoing = False
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_F1:    # F1 = New Game
                points = 0
                lives = 5
                picx = 0
                picy = 0
                speedx = 5
                speedy = 5
            
    picx += speedx
    picy += speedy
    
    if picx <= 0 or picx >= 700:
        speedx = -speedx * 1.1
    if picy <= 0:
        speedy = -speedy + 1
    if picy >= 500:
        lives -= 1
        speedy = -5
        speedx = 5
        picy = 499
    screen.fill(BLACK)    
    screen.blit(pic, (picx, picy))
    # Draw paddle
    paddlex = pygame.mouse.get_pos()[0]
    paddlex -= paddlew/2
    pygame.draw.rect(screen, WHITE, (paddlex, paddley, paddlew, paddleh))
    # Check for paddle bounce
    if picy + pich >= paddley and picy + pich <= paddley + paddleh \
       and speedy > 0:
        if picx + picw/2 >= paddlex and picx + picw/2 <= paddlex + \
           paddlew:
            speedy = -speedy
            points += 1
    # Draw text on screen
    draw_string = "Lives: " + str(lives) + " Points: " + str(points)
    # Check whether the game is over
    if lives < 1:   
        speedx = speedy = 0
        draw_string = "Game Over. Your score was: " + str(points)
        draw_string += ". Press F1 to play again. "
        
    text = font.render(draw_string, True, WHITE)
    text_rect = text.get_rect()
    text_rect.centerx = screen.get_rect().centerx
    text_rect.y = 10
    screen.blit(text, text_rect)
    pygame.display.update()
    timer.tick(60)
    
pygame.quit()       # Exit


# SmileyPong3.py
import pygame       # setup
pygame.init()
screen = pygame.display.set_mode([800, 600])
pygame.display.set_caption('Smiley Pong')
keepGoing = True
pic = pygame.image.load('CrazySmile.bmp')
colorkey = pic.get_at((0,0))
pic.set_colorkey(colorkey)
picx = 0
picy = 0
BLACK = (0,0,0)
WHITE = (255,255,255)
timer = pygame.time.Clock()
speedx = 5
speedy = 5
paddlew = 200
paddleh = 25
paddlex = 300
paddley = 550
picw = 100
pich = 100
points = 0
lives = 5
font = pygame.font.SysFont("Times", 24)
pygame.mixer.init() # add sounds
blip = pygame.mixer.Sound("blip.wav")
blap = pygame.mixer.Sound("blap.wav")

while keepGoing:    # game loop
    for event in pygame.event.get(): 
        if event.type == pygame.QUIT: 
            keepGoing = False
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_F1: # F1 = New Game
                points = 0
                lives = 5
                picx = 0
                picy = 0
                speedx = 5
                speedy = 5
            
    picx += speedx
    picy += speedy
    
    if picx <= 0 or picx >= 700:
        speedx = -speedx*1.1
    if picy <= 0:
        speedy = -speedy + 1
    if picy >= 500:
        lives -= 1
        speedy = -5
        speedx = 5
        picy = 499
        blap.play()

    screen.fill(BLACK)    
    screen.blit(pic, (picx, picy))

    # draw paddle
    paddlex = pygame.mouse.get_pos()[0]
    paddlex -= paddlew/2
    pygame.draw.rect(screen,WHITE,(paddlex,paddley,paddlew,paddleh))

    # check for paddle bounce
    if picy + pich >= paddley and picy + pich <= paddley + paddleh  and speedy > 0:
        if picx + picw/2 >= paddlex and picx + picw/2 <= paddlex + paddlew:
            speedy = -speedy
            points += 1
            blip.play()
            
    # draw text on screen
    draw_string = 'Lives: ' + str(lives) + ' Points: ' + str(points)
    # check to see if the game's over
    if lives < 1:   
        speedx = speedy = 0
        draw_string = 'Game Over. Your score was: ' + str(points) + '. Press F1 to play again.'
        
    text = font.render(draw_string , True, WHITE)
    text_rect = text.get_rect()
    text_rect.centerx = screen.get_rect().centerx
    text_rect.y = 10
    screen.blit (text, text_rect)
    pygame.display.update()
    timer.tick(60)
    
pygame.quit()       # exit



"仔细看!(加个提醒)"

2020-05-28T19:06:58 点赞:0

(获奖名单见评论区置顶)【六一活动】来时光游乐园玩游戏、寻线索、找宝藏! 中回复

center_image

2020-06-01T19:42:29 点赞:0

【源码精灵xNEMO】下载登录就送大礼包! 中回复

已经晚了,2020年6月5日13:51:13了。emotion_编程猫_伤心

2020-06-05T13:52:12 点赞:0

【源码精灵xNEMO】下载登录就送大礼包! 中回复

谁知道故宫源码蛋孵化多长时间?

            星光源码蛋呢?

2020-06-07T06:55:36 点赞:0

【赛事介绍】通天塔之王者争夺赛-S1赛季正式启动! 中回复

45个段位,谁玩?

2020-06-13T20:16:01 点赞:0

送金币啦! 中回复

我要-99999999999999999999999999999999999999999999999999999999999金币

emotion_编程猫_紧张

2020-06-13T20:18:14 点赞:0

社区星评选规则更新 中回复

 

我一定行!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

center_image

2020-06-14T15:33:14 点赞:1

社区星评选规则更新 中回复

先看看我的资料:

金币6890

赞5

收藏4

227次浏览

99个作品,54%发布

我好

emotion_编程猫_伤心

2020-06-25T13:14:25 点赞:1

【技术喵】关于电脑客户端的安装问题 中回复

I know I know,编程猫电脑版是

公测

公厕

2020-06-25T14:59:31 点赞:0

【KittenV4.1.1版本更新】超有料!克隆可以按编号识别? 中回复

请问可不可以下载kitten4.1.1程序添加到电脑

2020-06-26T19:35:37 点赞:0

【暑期活动】探秘一夏主题竞猜(获奖名单见评论区置顶) 中回复

【参与竞猜】:气泡鱼的秘密

2020-07-20T13:24:06 点赞:0

【暑期活动】社区史上周边奖励最多的小说、表情包、绘画活动!!! 中回复

center_image

2020-07-20T19:18:12 点赞:3

【暑期活动】社区史上周边奖励最多的小说、表情包、绘画活动!!! 中回复

center_image

2020-07-20T19:23:19 点赞:2

【暑期活动】社区史上周边奖励最多的小说、表情包、绘画活动!!! 中回复

center_image

2020-07-20T19:30:17 点赞:2

找师傅... 中回复

我,4个收藏,204次浏览,被2人关注,但是!

只有7个赞!(心灰意冷)

2020-07-21T11:19:32 点赞:0

【暑期活动】探秘一夏主题竞猜(获奖名单见评论区置顶) 中回复

【参与竞猜】:

天数                 内容

1                           气体

2                            (+泡沫)气泡

3                             (+鱼)气泡鱼

4                               (+ 秘密)气泡鱼秘密

5                                (+的,+句式:XXX的XX)气泡鱼的秘密

所以,是气泡鱼的秘密

2020-07-21T19:44:48 点赞:0

找师傅!急!U_U 中回复

我有7个赞,4收藏,244浏览,被2人关注,望有对应!(才发出该帖子)

2020-07-21T19:48:33 点赞:0

【暑期活动】社区史上周边奖励最多的小说、表情包、绘画活动!!! 中回复

center_image

2020-07-21T19:51:20 点赞:1

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-23T09:50:21 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-23T09:56:58 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-24T19:23:12 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-24T19:24:11 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-24T19:24:19 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-25T18:24:53 点赞:1

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-26T16:25:18 点赞:0

【暑期活动】源码积木表情包~~创作专属表情包!!!(获奖名单已公布) 中回复

center_image

2020-07-27T06:42:01 点赞:1