鱼C论坛

 找回密码
 立即注册
查看: 13003|回复: 4

[Pygame] draw | Pygame中文文档

[复制链接]
发表于 2015-6-18 23:57:45 | 显示全部楼层 |阅读模式
购买主题 已有 12 人购买  本主题需向作者支付 10 鱼币 才能浏览
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2017-1-5 23:25:36 From FishC Mobile | 显示全部楼层
画的挺好,笔力硬朗,笔锋飘逸!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 2 反对 0

使用道具 举报

发表于 2017-9-21 11:41:54 | 显示全部楼层
请问这个输出如何转变成postscript文件呢?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-3-17 20:05:29 | 显示全部楼层
为什么运行后不生成小球?
import pygame
import sys
from random import *
from pygame.locals import *

class Ball(pygame.sprite.Sprite):
    def __init__(self, image, position, speed):
        pygame.sprite.Sprite.__init__(self)

        self.image = pygame.image.load(image).convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.left, self.rect.top = position
        self.speed = speed


def main():
    pygame.init()

    ball_image = "ball.png"
    bg_image = "map.png"

    running = True

    bg_size = width, height = 736, 334
    screen = pygame.display.set_mode(bg_size)
    pygame.display.set_caption("Play the ball")

    background = pygame.image.load(bg_image).convert_alpha()

    balls = []

    for i in range(5):
        position = randint(0, width - 45), randint(0, height - 45)
        speed = [randint(-10, 10), randint(-10, 10)]
        ball = Ball(ball_image, position, speed)
        balls.append(ball)


    clock = pygame.time.Clock()

    while running:
        for event in pygame.event.get():
            if event.type == QUIT:
                sys.exit()

        screen.blit(background, (0, 0))

        for each in balls:
            screen.blit(each.image, each.rect)

        pygame.display.flip()
        clock.tick(30)


if __name__ == "__main__":
    main()
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-8-31 23:23:38 | 显示全部楼层
aaron.yang 发表于 2020-3-17 20:05
为什么运行后不生成小球?

你这个生成了呀
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-5-5 18:25

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表