-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintro2.py
31 lines (23 loc) · 903 Bytes
/
intro2.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
import pygame
class Intro2:
def __init__(self, screen, speed=2):
self.screen = screen
self.bg= pygame.image.load("assets/images/intro/3/bg.png").convert_alpha()
self.image= pygame.image.load("assets/images/intro/3/char.png").convert_alpha()
self.speed = speed
self.x = 0 # Starting x position
self.done = False
self.y = 0
self.endx = -700
self.endy=-400
def check_events(self, event):
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
self.done = True
def update(self, screen):
screen.blit(self.bg, (self.x,self.y))
screen.blit(self.image, (30,30))
if self.x>= self.endx:self.x -= self.speed
if self.y >=self.endy: self.y-=self.speed
if self.x <=self.endx and self.y <=self.endy:
self.done = True