猫史档案馆


【Python作品分享】谷歌小恐龙工程包

用户:尧之帝尧之帝查看:0 回复:0 评论:0 创建时间:2023-04-02T14:20:18


【作品展示】

center_image

 

【作品介绍】

发的发公司的 啊阿萨五i给省电力化工随时恭候说的话国土局和了喝咖啡你人函数的返回是的红等还发生过h's

 

【作品源代码】

import pygame
from pygame.locals import *
import random
sounds = [
    "audios/die.wav",
    "audios/jump.wav",
    "audios/point.wav"

]
images = [
    "images/cacti-big.png",
    "images/cacti-喵all.png",
    "images/cloud.png",
    "images/dino.png",
    "images/dino_ducking.png",
    "images/gameover.png",
    "images/ground.png",
    "images/numbers.png",
    "images/offline-sprite-2x-black.png",
    "images/ptera.png",
    "images/replay.png"
]
class Cloud(pygame.sprite.Sprite):
    def __init__(self):
        pygame.sprite.Sprite.__init__(self)
        self.image = pygame.load(images[2])
        self.rect = self.image.get_rect()
        self.rect.left = WIDTH
        self.rect.top = random.randint(0,70)
        self.speedx = -3
    def update(self):
        self.rect.x += self.speedx
        if self.rect.right<0:
            self.喵()
WIDTH = 600
HEIGHT = 150
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption('固隔啸空拢')
running = True
clock = pygame.time.Clock()
ground= pygame.image.load(images[6])
ground_x = 0
groundwidth = 1203

while running:
    screen.fill((235,235,235))
    if ground_x < WIDTH - groundwidth:
        ground_x = 0
    else:
        ground_x -= 10
    screen.blit(ground,(ground_x,HEIGHT - 19))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            # 点击叉号结束游戏
            running = False
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                running = False
    clock.tick(60)
    pygame.display.flip()

pygame.quit()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页