2022-04-04から1日間の記事一覧
import pygame import sys SCREEN = pygame.Rect(0, 0, 400, 400) WHITE = (255, 255, 255) class Ball(pygame.sprite.Sprite): def __init__(self, image_file, pos, speed): pygame.sprite.Sprite.__init__(self) x, y = pos vx, vy = speed self.image = …
import pygame import sys SCREEN = pygame.Rect(0, 0, 400, 400) FPS = 30 WHITE = (255, 255, 255) def main(): pygame.init() clock = pygame.time.Clock() screen = pygame.display.set_mode(SCREEN.size) ball = pygame.image.load('ball.png') ball_wi…
import pygame import sys SCREEN_SIZE = (400, 400) WHITE = (255, 255, 255) RED = (255, 0, 0) FPS = 1 def main(): pygame.init() clock = pygame.time.Clock() screen = pygame.display.set_mode(SCREEN_SIZE) ball = pygame.Rect(100, 100, 10, 10) wh…