forked from namankr1/SimPhy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animation2.py
36 lines (35 loc) · 1.04 KB
/
animation2.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
import pygame
import sys
import inputbox
from game2_ending import game2_ending
from pygame.locals import *
from const_colors import *
from constants import *
class animation2:
def __init__(self,DISPLAY_SURF,direction,text):
FPS = 30
fpsClock = pygame.time.Clock()
DISPLAY_SURF = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT), 0, 32)
pygame.display.set_caption('Animation')
block = pygame.image.load('Images/game2/3.png')
background = pygame.image.load('Images/game2/4.png')
DISPLAY_SURF.blit(background,SCREEN_TOPLEFT)
blockx = 267
blocky = 0
textpos = text.get_rect()
textpos.x = 0
textpos.y = 350
background.blit(text, textpos)
while True : #main game loop
DISPLAY_SURF.blit(background,SCREEN_TOPLEFT)
if direction == 'down':
blocky += 5
if blocky > 450 :
game2_ending(DISPLAY_SURF,"Oops.. The block fell down !")
DISPLAY_SURF.blit(block, (blockx,blocky))
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
fpsClock.tick(FPS)