-
Notifications
You must be signed in to change notification settings - Fork 1
/
stage6.py
58 lines (44 loc) · 1.72 KB
/
stage6.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#energize
import pyganim
import random
from .stage import Stage, Text
class Stage6(Stage):
def __init__(self, resolution):
super().__init__(resolution)
self.drink = pyganim.PygAnimation([("images/spam_can.png", 10)])
self.drink.rotate(90)
self.drink.play()
self.avatar = pyganim.PygAnimation([("images/g&w1.png", 10)])
self.avatar.play()
self.yeah = pyganim.PygAnimation([("images/thumbs.png", 10)])
self.yeah.play()
self.reset()
def reset(self):
self.texts = [Text("Shake and energize", (255, 255, 255), self._center_text)]
self.shake = 0
self.pos = [500, 100]
self.victory = False
self.target_shake = 1000
def update(self, input, tick):
if self.shake < self.target_shake:
if input.left_hold or input.right_hold or input.button_hold:
self.pos[0] += random.randint(-10, 10)
self.pos[1] += random.randint(-5, 5)
self.shake += random.randint(1, 30)
if self.shake >= self.target_shake:
self.victory = True
self.texts = [Text("YEAHHHHHHHHH~!", (255, 128, 100), self._center_text)]
self.shake += tick
if self.shake > self.target_shake + 1000:
return True
def draw(self, screen):
screen.fill([128, 128, 128])
super().draw(screen)
if self.shake < self.target_shake:
self.drink.blit(screen, self.pos)
self.avatar.blit(screen, [200, 200])
else:
rect = self.yeah.getRect()
rect.centerx = self.resolution[0] / 2
rect.bottom = self.resolution[1] - 100
self.yeah.blit(screen, rect)