SHOW:
|
|
- or go back to the newest paste.
1 | import pygame, sys | |
2 | from pygame.locals import * | |
3 | ||
4 | ||
5 | pygame.init() | |
6 | mainClock = pygame.time.Clock() | |
7 | ||
8 | WINDOWWIDTH = 800 | |
9 | WINDOWHEIGHT = 600 | |
10 | windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32) | |
11 | pygame.display.set_caption('Ude ga kento-chigai ni naru koto ga dekimasu') | |
12 | ||
13 | moveLeft = False | |
14 | moveRight = False | |
15 | moveUp = False | |
16 | moveDown = True | |
17 | ||
18 | moveSpeed = 4 | |
19 | ||
20 | BLACK = (0, 0, 0) | |
21 | WHITE = (255, 255, 255) | |
22 | GREEN = (0, 255, 0) | |
23 | px = int(0.1) | |
24 | py = int(0.1) | |
25 | ||
26 | player = pygame.Rect(400(px), 300(py), 10, 10) | |
27 | floor = pygame.Rect(0, 500, 800, 100) | |
28 | while True: | |
29 | for event in pygame.event.get(): | |
30 | if event.type == QUIT: | |
31 | pygame.quit() | |
32 | sys.exit() | |
33 | ||
34 | while moveDown == True: | |
35 | py += int(1.5) | |
36 | ||
37 | ||
38 | pygame.draw.rect(windowSurface, WHITE, player) | |
39 | pygame.draw.rect(windowSurface, GREEN, floor) | |
40 | ||
41 | pygame.display.update() | |
42 | mainClock.tick(40) |