forked from rczyrnik/pygame_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpygame_tutorial_ideas.py
38 lines (30 loc) · 951 Bytes
/
pygame_tutorial_ideas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
Change the rectangle's color when we click on the moving rectangle
'''
# IMPORTS
import sys
import pygame
import random
# INITIALIZE PYGAME
pygame.init()
# CREATE THE SCREEN -------------------------------
screen_width=800
screen_height=600
screen = pygame.display.set_mode((screen_width, screen_height))
red, blue, green = 100, 100, 200
screen.fill( (red, blue, green) )
# ADD A RECTANGLE ---------------------------------
my_shape = pygame.image.load('img/more_ideas.png')
my_shape = pygame.transform.smoothscale(my_shape, (screen_width,screen_height))
my_shape_rect = my_shape.get_rect()
my_shape_rect.topleft = (0,0)
# DISPLAY IT ALL ----------------------------------
screen.blit(my_shape, my_shape_rect)
pygame.display.update()
# RUN THE GAME ------------------------------------
amt_to_move = 2
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()